Last month it was Stockton, and now San Bernardino, California is preparing to file for bankruptcy. Like Stockton, San Bernardino is a large, working-class city on the fringe of a prosperous, coastal metropolitan area. And like Stockton, it was especially vulnerable to the structural problems in California that can push cities into bankruptcy.

Sometimes, municipalities end up in bankruptcy for idiosyncratic reasons: Orange County made bizarre investments in derivatives that turned bad; Mammoth Lakes lost a devastating court case for breach of contract. Usually, however, a city goes bankrupt because two things happen together: It makes policy mistakes, and then it gets hit with unexpectedly bad economic conditions.

That's what happened in both Stockton and San Bernardino. In each city, house prices soared about 200 percent during the property bubble, inflating the tax base and allowing the cities to make unwise promises to public employees. Then the bottom fell out: Prices crashed back to where they had been a decade before, and the tax base could not support the payments governments had promised.

The problem for the Inland Empire (which includes San Bernardino) and the Central Valley (home to Stockton) is that California's fiscal system is built to serve the coast. Property taxes are capped at 1 percent of value. Because property values are so much higher on the coast, and fell so much less drastically in the housing crash, the tax cap has strained local budgets much more inland than on the coast in California.

On the expense side, bargaining and benefits laws encourage municipalities to offer high and inflexible compensation. That can be more easily supported in places like Silicon Valley, where huge location advantages can attract businesses despite a high tax burden and middling public services, than the Inland Empire, which has few particular advantages over low-cost Nevada and Arizona.

Vallejo, which recently emerged from bankruptcy, is near the coast, but it's the exception that proves the rule: a working class city that enjoys few of the economic advantages of the Bay Area.

In the next few years, most California cities and counties will have to restructure the budgets. In some places, mostly inland, that will require bankruptcy; healthier jurisdictions will still take unusually drastic non-bankruptcy measures, as San Jose has done.

For the long-term fiscal health of its cities, what California needs is more fiscal localism: handing local governments control over their tax systems and their employee compensation policies. That way, they will be able to make promises that are affordable and manageable, and collect the taxes they need to perform on them. Without such reform, the quality of public services in California will continue to deteriorate -- and whenever there is a property bubble, California's less-well off jurisdictions will be at risk of bankruptcy.

(Josh Barro is lead writer for the Ticker. Follow him on Twitter.)

Read more breaking commentary from Josh Barro and other Bloomberg View columnists and editors at the Ticker.