Question: Assume this city is relatively large by late medieval standards, around 200,000 people. The city is mainly a site for trade due to its geographically central position and being on a river. Also, because it is geographically central, it also means the city is important for the government to project power.

**What might be the benefits for this same government to sanction certain crime within this important trade city?**

Crime that would be considered legal within city limits ranges from murder, burglary, trade of illicit substances, and racketeering. This is all under the condition that the crime does not directly affect the government's activities.

Answer: 
### To punish them.

Looking at your situation from a modern lens - Politicians love spending money on those who voted for them, and also those who could be plausibly convinced to vote for them. They don't like spending money on those who voted strongly against them. Dishing out favour in this way is known as [pork barreling](https://en.wikipedia.org/wiki/Pork_barrel).

So there's a town where people didn't vote for you / send enough tax money to you / support you in a recent coup / send enough virgins to your harem / whatever spited you. You can show your disaproval by screwing them over at the next chance you get. Maybe their tax rate is raised, or maybe they get less resources allocated.

You can also send them a message by withdrawing or reducing the police. The safety of that community is less of a concern for you if you want to teach them a lesson - they're not going to vote for you / support you / etc, why should you waste resources on them?

Perhaps after a few months of crime running out of control they'll learn their place and they'll be better subjects next time.
Instead of government-sanctioned crime, what about a small area with a different government or no government? It could be an independent city where three or more large countries meet, and none of the countries can take it over because the others wouldn't let them. This also gives a good explanation for why there would be lots of devious machinations going on by various government agents in the city, and it would be a prosperous trade hub if it is the best route between those nations.