There were craftsmen and laborers inside the walls but it would be unheard of for someone without a purpose to be allowed inside. There is a similarity though between Chinese society and the Medieval feudal system, and in fact in China there was a history of warlords protecting provinces in exchange for food and money.