The financial crisis has exploded plenty of long-held beliefs, including the idea that mortgage debt is a risk-free investment. But nothing has shaken the articles of faith that underpin another massive debt market: municipal bonds. Investors in municipal bonds don’t have to worry about a thing, the thinking goes, because the states and cities that issue them will do anything to avoid reneging on their obligations—and even if they fail, surely Washington will step in and save investors from big losses.

These are dangerous assumptions. Just as with mortgages, the very fact that investors place unlimited faith in a market could eventually destroy that market. If investors believe that they take no risk, they will lend states and cities far too much—so much that these borrowers won’t be able to repay their obligations while maintaining a reasonable level of public services. The investors, then, could help bankrupt state and local governments—and take massive losses in the process. To avoid that scenario, investors must take a long, hard look at what they’re doing. Where state and local finances are untenable, they should stop throwing good money after bad.

You might think that municipal bonds would have lost their low-risk reputation. In the past two tumultuous years, tax revenues have plummeted by double-digit percentages, and state and local governments have struggled to close historic deficits. Nationwide, they face cash operating gaps of $200 billion, or 15 percent of their budgets, through 2011. Big spenders have shown no sign of cutting costs in line with a new reality. Ordinarily, if a borrower is in such straits, lenders start thinking twice about lending it yet more money: Who’s to say that the borrower won’t declare bankruptcy and default on its obligations?

Yet the industry’s gatekeepers still consider municipal bonds low-risk. “We do not expect that states will default on general-obligation debt, even under the most stressed economic conditions,” analysts at Moody’s, one of the three major credit ratings agencies, wrote in a February 2010 report. As for cities and towns, “we expect very few defaults in this sector given the tools that local governments have at their disposal.” The firm’s chief competitor, Standard and Poor’s, agrees.

Why are the ratings analysts so sanguine? First, they assume that states and cities will do anything to avoid default. As John V. Miller of Nuveen Asset Management told clients in 2009, “State and local governments have strong incentives to maintain access to the credit markets.” The main incentive, of course, is their desire to borrow more tomorrow, which depends on demonstrating that they would never renege on their obligations today.

The analysts also think that lending to state and local governments isn’t risky because they—unlike private firms—have a captive source of endless funds. If a company misjudges its product line or its prices, its customers and investors can flee, depriving it of money; such a company will have a hard time persuading anyone to give it one dollar more. State and local governments, by contrast, can always tax their residents and businesses to pay the bills, even as they gut services.

The ratings analysts find further reassurance in the law. State governments can’t legally declare bankruptcy to escape debt: the federal bankruptcy code doesn’t cover them, and they can’t write their own bankruptcy laws because the Constitution reserves that power for the federal government. Cities, towns, and counties, meanwhile, can file for bankruptcy only if their state governments allow it, and more than half of the states don’t. Moreover, federal law requires eligible cities and towns to meet a strict standard for insolvency. A private firm can file a “strategic bankruptcy,” looking ahead a few years and determining that bankruptcy now will avoid bigger problems later, but cities and towns must prove that they are already unable to pay their bills. In the early 1990s, a judge threw out the bankruptcy petition of Bridgeport, Connecticut, finding evidence that someone, somewhere was still willing to lend the city money.

The analysts take comfort in financial engineering, too. Over the past two decades, the underwriters who help state and local governments raise money have found ever more creative ways to dodge obstacles that theoretically constrain borrowing—but the underwriters have simultaneously built in conditions that reassure bondholders. New York State, for example, currently owes just $3.3 billion in “general-obligation bonds” because these bonds require voter approval. Yet the state has racked up $59.3 billion in total debt, often by setting up special “trusts,” legally separate from the state government, that issue bonds of their own. The state pledges to direct tens of billions of dollars automatically to the trusts, enough to pay the debt costs many times over; the trusts use that infusion of cash to pay the debt and then give the leftovers back to the state. Even though investors in trust-issued bonds don’t have a direct state guarantee, they don’t mind because the trust provisions make the debt seem so safe. To assuage investors further, the state explicitly outlaws bankruptcy for big issuers, such as the Metropolitan Transportation Authority (MTA).

Another line of defense for analysts, advisors, and investors is the theory that the federal government regards the biggest municipal debtors—such as New York, California, and the borrowers that they in turn oversee, like the MTA—as “too big to fail.” After all, back in 1975, when New York City stood on the brink of default, Washington helped Albany bail it out. In 2008, Washington, fearing a global meltdown, went to extraordinary lengths to rescue creditors to AIG. This spring, the European Union made it clear that it would not let Greece default on its government debt. If necessary, observers figure, New York would bail out the MTA, and Washington would bail out New York.

Finally, ratings agencies and investors point to the past. In the Great Depression, municipal-bond investors lost a tiny one-half of 1 percentage point of their money. And between 1970 and 2000, according to a Moody’s study, of the nearly 376,000 cases when rated municipal-bond issuers could have defaulted, only 18 actually did, compared with 819 corporate defaults out of the more than 61,000 possible. Losses, and even the threat of losses, have confined themselves almost exclusively to the relatively riskier side of this nearly risk-free market. It’s not states and cities themselves that have defaulted on debt, but special entities that they set up to fund projects like hospital and dormitory construction. Between 1970 and 2000, no investor took a loss on a state’s or a city’s general-obligation debt. Even Orange County, California, which declared insolvency in 1994 to protect its pension assets from seizure after a rogue employee bet the money on derivatives, repaid its lenders every dime, with interest.

If the analysts’ confidence sounds familiar, that’s because we’ve heard it before. Before 2006, conventional wisdom held that if you wanted a risk-free investment, you couldn’t do better than buy mortgage-backed securities. Homeowners were willing and able to repay what they owed you. Even if a homeowner couldn’t make his monthly nut, he could always raise cash to repay the mortgage by selling his house at a higher price. In addition, federal law protected lenders. Struggling homeowners couldn’t turn to bankruptcy to escape their mortgage debt; they could escape it only by returning the house to the lender, and the house almost never lost value. Financial engineering provided another layer of security: underwriters and ratings analysts had designed such airtight structures that losses would have to reach truly unfathomable levels before most investors had anything to worry about. History, too, justified confidence.

Yet in the end, investors pumped so much money into that supposedly airtight market that they blew it apart. In being so free with their money, investors in mortgage-backed securities and other mortgage debt ignored the obvious: homeowners would never be able to repay everything they were borrowing. Only while house prices were soaring could homeowners afford their mortgages and other living expenses by refinancing. But this vacation from reality couldn’t last forever because home prices couldn’t—and didn’t—maintain their torrid growth forever. All those protections that lenders enjoyed didn’t matter a bit if borrowers couldn’t and wouldn’t repay what they owed.

Like homeowners, state and local governments spent the boom years using illusory gains to justify ever-higher spending and borrowing. Between 2000 and 2008, state tax revenues, buoyed by the housing and financial industries, outpaced inflation by 15 percent, according to the Census Bureau. Local tax collections mushroomed, too. But instead of using all this money to reduce their debt, state and local governments spent it on rising public-education costs and expanding Medicaid for poor and working-class residents. The biggest partners in profligacy—California, Illinois, New Jersey, and New York among them—also piled on public-sector labor costs. Just to pay the generous pensions and health benefits of their workers, many of whom can retire in their mid-fifties, state governments face a trillion-dollar shortfall over the coming decades, the Pew Center on the States recently reported.

Even during the boom, money fell short. By 2008, state and local debt rose to $2.2 trillion outstanding—49 percent higher, after inflation, than in 2000. Add the health and pension benefits for government workers, and you’re up to a staggering $3.2 trillion. Once the recession’s severity became apparent, state and local officials should have realized that hard fiscal times were coming and begun cutting back on the unsustainable costs. Instead, they have kept on spending, and borrowed to do it: states alone have already borrowed another $15 billion for operating costs over the past two years.

Municipal bond buyers are partly to blame for state and local governments’ failure to face reality. True, there are other culprits, such as President Obama’s 2009 stimulus package, which poured more than $200 billion of reality-distorting funds into municipalities’ coffers so that they could keep hiking their spending. By 2011, stimulus money will have filled about 6 percent of states’ revenue shortfalls, obscuring the need for fiscal reform. But now that stimulus cash is running out, states are falling even more passionately into the arms of all-too-willing debt markets. In New York, for instance, Lieutenant Governor Richard Ravitch has proposed an intricately detailed $6 billion borrowing plan to help close $60 billion in operating deficits over five years but hasn’t said a word about how exactly to cut spending. The ratings analysts remain calm, with Moody’s observing in early March that New York has a “long track record of closing annual budget gaps” and Standard and Poor’s reminding investors of the state’s rosy “history of what we consider conservative budgeting.”

Washington has made things even worse with “Build America Bonds,” part of the stimulus package. Usually, municipal bonds offer comparatively low interest rates because lenders don’t have to pay taxes on their interest income. But investor demand is limited to people who need this benefit. Build America Bonds, by contrast, are taxable, so they offer higher interest rates; state and city governments issue them to a bigger market, but the feds cover the higher interest costs. Big borrowers have ably exploited this invitation to borrow still more. California, New York, and Illinois have already issued $31 billion in such bonds, or 40 percent of the year-old program.

Thanks to Build America—and also to the Federal Reserve’s 0 percent interest-rate policy, which lets borrowers access cash cheaply—2010 may be a record year for municipal-debt issuance and a lost year for fixing state and local budgets. The average state owes 2.1 percent of its citizens’ annual personal income. California owes 4.4 percent, New York 5.4 percent, and New Jersey 6.7 percent. New York’s Citizens Budget Commission recently added future retiree obligations to that statistic and found that six American states—New York and New Jersey among them—are on the verge of a “danger zone.”

What will they do if they enter that danger zone in the coming years? Perhaps what overindebted homeowners did in tearing up the conventional wisdom about their ability and willingness to repay their mortgages. Once state and local governments have borrowed too much, they may well find a way not to pay their lenders back.

To get a glimpse of the future, look to Vallejo, California, about 30 miles north of San Francisco. Like many municipalities, this city of 117,000 residents found itself hard hit by the housing bust, with property-tax revenues falling by more than a quarter in two years. Vallejo first tried to address the crisis the way other cities have: cutting staffing sharply and slashing everything from public safety to road maintenance. But crime shot up, and citizens got angry (see “Vallejo Goes for Broke”).

Instead of firing workers, Vallejo might have cut their wages and benefits—but its agreements with public-sector unions prohibited that. The city was stuck paying the average police officer and firefighter more than $80,000, including annual raises of 19 to 21 percent between 2006 and 2009. Work rules, too, prevented Vallejo from streamlining. For example, it had to maintain minimum staffing at some locations, even as ever-scarcer resources were needed elsewhere.

So Vallejo did something unprecedented: in spring 2008, it filed for bankruptcy to fix its long-term problems. Seeing that the real problem was that “collective bargaining agreements control the city’s labor costs,” as Vallejo wrote in its court documents, it petitioned a bankruptcy judge to throw out those agreements so that it could restructure its long-term obligations. In court, Vallejo pointed to “hundreds of millions of dollars in debt that the city shoulders now for services rendered in the past, such as bonds, pensions, and retiree health benefits that consume a large and growing portion of the City’s annual budget.” For instance, city workers could still retire in their fifties with fat pensions, and current and future retirees still had promises of full health benefits for life.

In filing for bankruptcy, Vallejo violated the first principle of municipal-finance conventional wisdom: that cities and towns will do anything to avoid default. Vallejo was insolvent, true, but its managers could have emulated many of their counterparts around the nation in trying, through structured finance, to borrow more somehow and hope for the best. Vallejo, after all, is no more insolvent than California, which last year was reduced to hoarding its citizens’ tax refunds for months for extra cash. Vallejo owes bondholders 5.5 percent of its citizens’ personal income—little more than New York’s 5.4. (True, the financial situations diverge by several percentage points when you consider projections of pension and health benefits, but the unreliability of such estimates renders that gap meaningless.)

Vallejo chose not to pursue short-term heroics. The benefits of paring down contractual obligations, it decided, outweighed the costs of declaring bankruptcy—and it has already reaped rewards. A year ago, federal bankruptcy judge Michael McManus handed down a precedent-setting ruling that a bankrupt municipality has the right to cancel current collective bargaining contracts, even if doing so contradicts state labor law, as it does in California. In reaching his decision, McManus employed the long-standing principle that when laws conflict, federal law is supreme. McManus later agreed that Vallejo’s labor contracts were too onerous and sent unions and the city to arbitration and mediation.

Since it filed for bankruptcy, Vallejo has renegotiated contracts with three of its four unions (the fourth is still appealing). Employees have given up constricting work rules and even taken hefty salary reductions. Vallejo has won some long-term freedom, too. The city normally renews current retirees’ health-care benefits with each new collective bargaining agreement. This time around, with the old agreement thrown out, instead of paying 100 percent of its retirees’ health-care costs—which can reach a maximum of $2,250 a month per person—Vallejo will pay a maximum of $750 a month to some retirees. If the court approves Vallejo’s bankruptcy-exit plan this summer, the city will emerge from bankruptcy with $34 million in health-care obligations to retirees, down 75 percent from $135 million.

Throughout its bankruptcy, Vallejo has not paid the full amount it owes on its municipal bonds. (The city has just one big municipal bondholder, the Union Bank of California.) What’s more, it has proposed, in its exit plan, to defer payments on its bonds for three years, saving up cash and investing in infrastructure before paying lenders in full.

Yet the municipal-bond world has treated Vallejo’s bankruptcy as a minor annoyance, telling investors: move along, please, nothing to see here. Analysts have found much comfort in the fact that Vallejo didn’t file its bankruptcy to repudiate its bond debt. They take heart, too, in Vallejo’s seeming desire to repay that debt. A March report from Municipal Market Advisors was typical, criticizing a more pessimistic article from the financial-news outlet Barron’s as “ignoring, of course, the city’s own plan to repay all bondholders at 100 percent.”

But the muni-bond market may be so intent on ignoring Vallejo for fear that if it looks too closely, it might not like what it sees. Vallejo’s bondholders may get off relatively easily precisely because Vallejo stopped piling up obligations on its own, rather than trying one mad dash to borrow more. Vallejo didn’t follow, say, Illinois’ example: borrowing in the bond markets to fund future obligations to retirees. Vallejo knew that it had to cut future retiree obligations—and even so, it couldn’t do it without affecting bondholders, too.

Bondholders should realize, then, that they are vulnerable to real losses as cities, towns, and states move to escape massive health-care obligations to their retirees. At best, they’ll suffer the Vallejo bondholders’ fate—though a three-year deferral of payment is no small matter to an investor. At worst, they’ll take bigger losses as obligations pile up. It’s easy to imagine some future mayor convincing a bankruptcy judge that it’s only fair for bondholders, along with union members, to take big cuts in a restructuring. Indeed, heavily indebted governments’ willingness to repay crippling municipal debt will depend on what’s politically expedient. Today, politicians still see the advantages of borrowing more. Ten years from now, it may be more practical for a governor to tell the public: we’ve borrowed too much, we did so because clever Wall Street investors convinced our predecessors that it was a good idea, and we shouldn’t have to pay those investors back.

Investors continue to assume that financial calculations would trump political calculations in such a case—that is, that no state or city would default, even if the public supported it, because it would cut off the borrower’s access to credit markets. But that would be true only if the state or city in question considered immediate access to bond markets more important than cutting the amount it already owed. Furthermore, a state or city that did cut down its obligations might, strangely enough, have an easier time getting financing afterward, since new bondholders would know that its finances were finally sustainable.

The uncomfortable truth is that as municipal debt grows, the risk mounts that someday it will be politically, economically, and financially worthwhile for borrowers to escape it. When that happens, the protections that lenders supposedly enjoy will be meaningless. Lenders shouldn’t take solace in states’ inability to access federal bankruptcy codes: a state could certainly stop making payments on its debt without formally going into bankruptcy. As for complex financial engineering, a future elected official could convince the public that the “trust” structure that New York uses to issue bonds is a fraud perpetuated by corrupt former officeholders—a deliberate attempt to nullify voters’ right to limit indebtedness—and withhold payments to the trusts and hence to their bondholders. This would mean years in court, and, in the meantime, the bondholders would go unpaid.

But there’s always Uncle Sam, right? Maybe not. In relying on future bailouts, investors are taking a gamble. Consider how thoroughly the public remains fed up with the bailouts of AIG’s creditors, who should have known better than to lend so imprudently. Furthermore, in bailouts where the federal government’s aim has been not to save the financial system but to force a borrower to restructure its obligations, bondholders have fared poorly. When the White House rescued Chrysler and General Motors, it forced bondholders to take bigger losses than union members did, despite bondholders’ higher claim.

A practical limitation on federal bailouts exists, too, and investors would do better not to reach it. Washington cannot guarantee all debt. In March, Moody’s questioned the resilience of America’s AAA credit rating, noting that “preserving debt affordability” at the federal level “will invariably require fiscal adjustments of a magnitude that . . . will test social cohesion.” To get its finances in line, in other words, the United States must already slash spending to such an extent that it will risk the wrath of the targets, likely including public-employee unions and Medicaid recipients. Shouldering the debt burdens of bankrupt states and cities would make the situation even graver. Faced with a choice between preserving “social cohesion” and saving municipal or corporate bondholders, the feds would be likely to pick social cohesion, throwing some creditors out of the bailout boat.

That’s the better scenario, in fact. The worse one is massive inflation, effectively a wholesale repudiation of all government debt.

Disaster isn’t inevitable. But to avoid it, states and cities badly need the financial discipline that sober markets can provide. Municipal investors should ask themselves a few simple questions. Is it not daft to lend New York and California one dime more? Are certain states’ and cities’ finances sustainable, absent a bubble or a miracle? If not, aren’t today’s investors just hoping that they’re not the last ones left holding bad paper? Asking and answering these questions could save bondholders money—and could also force state and local politicians to address reality before it’s too late.