Say the city has invested in infrastructure, has a thriving industry etc. That typically isn't "portable". To get a return on that investment they need residents.
The residents naturally want things like insurance etc. It's high though - a barrier to entry. The city runs the numbers and decides that a resident is a net win even after insurance subsidies are applied.
Now granted, the calculation isn't that simple, and usually these things come with much hand-waving. But its not as simple as "other tax payers assuming the risk".