As for the whole town distance stuff, about 7 miles would be about a days journey by horse, a few more by foot. I just figured it had more to do with travelling distance than the spoilage rate of milk.
It has more to do how much food and other resources can villages output.
Town/City population needs to be supported by farms. They can be only be spaced close if soil is very rich and climate allows best crops.
Traveling distance is less of issue, there are enough varieties of food that do not spoil in half a day and farms that are very close to city can specialize in them. Besides, ever heard of cheese or butter? Or dried fruit? City does not really need supermaketesque food variety or super-fresh food.
Traveling distance of course matters: it must be worth it to haul food from farm to city. Beyond certain distance, farmer must rely on third party to deliver food instead of having option of doing it himself. That generally means that he first delivers to town and sells to local businessman which then delivers it do city for final sale.
It is pretty much fractal things:
City is surrounded by several towns which supply it, town is surrounded by several villages that supply it, village is surrounded by several farms.
Pure farming redistribution town is not only case thou, usually you get towns that form around other features (i.e. towns spaced at 1-day travel time distance on line connecting cities, towns that form in vicinity of major military installations (castles) or mines.).
Look atnight side photos of earth: settlements form web.