This is how I think it should work:
Let's say that City A and City B produce 100 food units each, but only need 80 food units to maintain its population, getting a surplus of 20 food units each.
50% of the food surplus would be removed, maybe to a Central Wharehouse or Great Granary (could exist from the beggining, after achieving certain conditions like X number of cities or tech Y researched, or could be a National Wonder) leaving 10 food units for growth in each city.
The other 20 food units would then be distributed to cities that don't produce enough (Cities C & D) in such quantities that they would not lose population but they would not grow either. Let's say 12 food units was thus distributed, which leaves 8 food units.
This remaining food would then be distributed equally to all cities, 2 food units to each. This would ensure that all cities would still grow, but cities C & D would grow slowly. This would make a city with good production squares or Bonuses on their radius but few food squares viable, allowing the existence of cities focusing only on production (Wonders, military units, etc...). It would also enable the construction of cities in choke points, those cities could be used like military bases protecting your borders or stoping rivals from expanding in that area.
In alternative the 8 remaining food units could go back to the original surplus cities, A & B, or it could stay in the Wharehouse against a time of need, trading it for a Gold Bonus after a certain amount, or to be used for trade with other nations. In this case population growth of the Production Cities could then be enabled by the use of Caravans or something like that (food for the caravans could be taken from the Central Wharehouse). Caravans would not need to be specific units built in cities, you could have a certain amount of Caravans to use per turn.
I'm no modder though or I would try to do something of it. Unfortunately I have no such skills.