I have been playing exclusively with the faction that allows for increased food production; I am unsure if this is something that happens with the other factions. I have also been playing exclusively with the "Miner/Organized/Ugly" sovereign so I'm not sure if this also pops up with other sovereigns. With these settings I have reproduced this 10+ times.
What happens is that as soon as any one city hits level 5, I demolish every single building providing housing, any small food buildings like gardens, and any small prosperity buildings like temples or town halls.
Unsure if this is intentional or not, but the town maintains its level 5 size/population. It frees up building squares so the town can convert itself into a research/gilden/production powerhouse. All the large food income that you were using from Farms/Apiaries/Orchards/Oases are all freed up and can immediately goto other towns, reducing and usually entirely eliminating the need to build small food buildings like gardens.
While this has made for loads of fun in punishing the enemy factions and neutral monsters, I get the hunch that this is not intended and so I'm reporting it. Sorry if it's already been reported; I gave a quick search and didn't find anything.