Say there is a country that is ruled by a king, medieval era style. It rules over several cities and towns, maintaining control with a national guard.
Now let's say within the boundaries of this country, but close to the border, is a city that has rejected the monarchy, and rules itself.
There is no established government in this city, and no leaders. There are several gangs, large and small ones, that operate on an honor based system. There are people that are not "within" a gang (like inn owners etc.), but most people have an unofficial affiliation with at least one faction.
Each of the gangs understand that if they were to fight with each other constantly, no one would benefit. So grievances are hashed out in a fighting pit. This can be between individuals within gangs, or entire gangs pitted against each other.
There is a lot of crime in this city, as there are no official laws, but there are a set of 'rules' people are expected to adhere to (no stealing and no murder included). If these rules are broken, they get thrown into jail without a trial. Once the jail is full the individual prisoners fight it out in the pit, and the last one surviving gets freed.
It is a flawed system, as the strongest survive even after multiple infractions, and gangs tend not to rat out their own very often, but it has kept the peace between gangs for many years, and everyone accepts it.
Most of the larger gangs have chapters in cities around the country that still come under the reign of the king. The monarchy accepts their presence, as none of the gangs are large enough to pose a threat to the throne individually, but if they combined they might overthrow the entire country. So it is in their best interest to have them pitted against each other, rather than join forces.
The gangs offer services to people and businesses, from basic mercenary work like protecting trade caravans between towns, to basic farm labor at the harvest, to assassinations (by the less reputable gangs).
How would the lawless city function at an economic level? Could earning money from the separate chapters and funneling it to this town provide them with enough money for trading for goods? How large could such a city become before it simply collapses due to the lack of infrastructure and government?
There are probably more considerations for a lawless town to function that I'm overlooking, so feel free to throw them in if you choose, but I feel the biggest problem would be maintaining a flow of money without taxes etc.
People do live in/near and trade with this town so they don't have to pay taxes, but as there is no government they are generally at the mercy of bandits etc. which is where caravan protection becomes a lucrative business. But would it be enough?