From the McDonald's UK website:
" Why do prices vary from restaurant to restaurant?
The overall aim for each of our restaurants is to provide food at a competitive value-driven price for our customers. Prices will vary slightly between different restaurants according to a number of factors. We set prices using a demand based methodology, which means there may be price variations from restaurant to restaurant, but in a way that offers best value to that restaurants' individual customer base."
As I read it, that means that restaurants that are constantly packed with customers can afford to charge slightly less for products than those that have fewer customers to make their profits from.
Other factors will obviously come into play too, of course. For example the two nearest branches of McDonald's to my house are both open 24 hours, so they need to have a pricing structure that enables them to have staff on duty in the early hours of the morning, when demand is very low. (Rent and rates have to be considered too).
It's not unusual for big chain restaurants to have very different prices in different areas. For example, J D Wetherspoon charge several pounds more for the same meal in some pubs than they do in others.