What might be the benefits for [a] government to sanction certain crime within [an] important trade city?
There are already excellent answers to this question, but to add some more real world details that have been overlooked:
Strengthening Colonial Rule
The most famous real-world example is Hong Kong. In order (a) to facilitate illicit trade in opium and other products, (b) to enjoy an additional local spy network in a large and hostile neighbor, and most importantly (c) to maintain a semblance of order over a large population whose language few of the colonial administration spoke, the Brits maintained deals with the Triads to essentially outsource most public order over the Chinese slums to powerful criminals. The "tea money" hongbao provided by the gangs were also prime sources of income for the colonial police. Things were periodically shut down or renegotiated, as after the 1956 Double Ten Riots, but the Triads were so entrenched that even the PRC were forced into deals with them during the handover and has only been slowly chipping away at them since, usually when they start messing around on the mainland. There are tons of books, TV shows, and movies about this era but lots of them are in Cantonese. To bring the same idea closer to home, The Shield dramatizes the LAPD's similar accommodation of crime as a way of handling the endemic mess in the poorer neighborhoods of Los Angeles. Essentially, apart from enriching themselves, the Farmington police are shown choosing their battles, angling for local black and hispanic criminal leaders who keep the violence and crime away from better (and whiter) neighborhoods and away from directly harming the local children or the police themselves.
Handling Temporary Emergencies
In New York City during World War II, the US gov't made common cause with the mafia in part to get a better spy network in the leadup to the invasion of Sicily but also to maintain control over longshoreman and other important labor unions involved in maintaining the armed force's logistical network. It wasn't until the 1960s that the Feds got around to cleaning any of that up, in part because they were grateful for the assistance in tamping down any possibility of strikes during the war years.
Illicit Profits Exceeding Gov't Revenues
Another important real-world example is the accommodation of the narcotraficantes by governments in Central and South America, especially Mexico. Although coordinated government action limited local problems for years, over time the amount of money involved in funneling drugs and people through to the US erupted into massive turf wars within Latin America itself. Disunity between local and federal parties didn't help, but mostly the flow of cash reached the point where nearly the entire law enforcement apparatus could be bought, the rest could be hunted, and (push come to shove) local gangs have sometimes been better armed than the national military.