In my country, the price is same across all the states
In my country, the price is same across all the states
Land taxes, shipping costs, utility costs, average local salary pushing up (or down) the wage floor they hire at, all influence the minimum amount of money any particular restaurant needs to make to break even or be profitable.
Since they're all owned independently and merely rent the name (and sometimes the land) from the McDonald's corporate entity, they have some leeway on setting their prices. There's a whole lot of rules they have to follow, of course, but that's the jist.
Usually, prices don't vary much, if at all, when looking at a smaller area or among locations owned by the same person.
The exceptions are if a particular location is especially expensive or high demand, such as interstate highway rest stops or when the location is attached to a highly trafficked gas station. The rents and taxes on those locations alone are enough to push prices up.