To exist within a walled city is to exist within the rules of the walled city. Each one has its own rules, regulations, and means of enforcing them.
The most common punishment is exile. You are forced out, never to return. Jails are expensive, and the wilds outside a walled city are usually a means to an end. But survive or not, it is all the same to the city.
Lesser punishments may incur work, or monetary punishments. Often times serving as a guard, ironically, is the punishment of choice. You have a chance to earn a trade, and you get to use physical force in a socially approved manner.
Some cities use magic in an attempt to push a criminal back onto the path of "righteousness". This can work... but it must be used with extreme precision. Often times magical compulsions need to align with a persons pre-existing desires, or they can slowly but surely drive the recipient mad from the internal stress.
The punishment of execution is used as a last resort by all but a few of the cities. The cities that choose that recourse easily are cities that few wish to visit. They also never seem to run out of criminals...
-Writings by Queen Augustine, on the walled cities of the continent