Ever since the financial crisis, investors have looked to bonds to protect them from the wild fluctuations of the stock market. Yet even as other parts of the bond market have started to show signs of losing ground, the municipal bond market has become more popular than ever. As investors start to focus on the huge looming tax increase slated to take effect at the beginning of 2013, can muni bonds continue to build on their strong past performance?

Why bonds have been hotter than ever
At first glance, interest in bonds seems to make little sense. Interest rates are near all-time lows, which you'd think would dissuade investors from committing their money to bonds.

But when you look at the trailing returns on bond funds, you can understand how inexperienced investors might believe that bonds have much more upside potential than they actually do right now. Long-term Treasuries have actually had double-digit percentage returns over the past five years -- a performance that most stock investors can only dream of. Higher-yielding corporate bonds haven't seen quite such strong returns, in part because the financial crisis sapped investors' confidence about corporates. But especially within the junk bond realm, the more plentiful income available from corporates has drawn attention from those who are hungry to produce cash from their portfolios.

Reversal of fortune
The dynamics of the bond market have changed recently, however. Funds that own high-yield corporates have seen massive outflows, while funds owning municipal bonds have seen inflows in 24 of the past 25 weeks.

One reason for that disparity comes from supply and demand. In the corporate arena, companies are issuing debt as quickly as they can. United Technologies (NYSE: UTX), for instance, made a truly massive offering of almost $10 billion in bonds last week, the biggest deal in three years. IBM (NYSE: IBM) found interest for its bonds even though three-year IBM debt yielded just 0.75%, while McDonald's (NYSE: MCD) shared IBM's low-coupon of 1.875% on seven-year bonds. Even industrial giant Caterpillar (NYSE: CAT) went to the trough for cheap money. Although United Tech needs the money for its takeover of Goodrich, the others simply wanted to tap into low-cost debt at what could prove to be the best possible time.

By contrast, the supply-and-demand situation for municipal bonds is much more supportive of higher prices. Many municipalities face challenging budget situations and are therefore cutting back on issuing debt, leaving the muni market with more debt maturing than new issuance can replace. The resulting shortage of muni bonds has pulled yields down to extremely low levels, in some cases approaching record lows. Even lower-rated muni debt has seen yields plunge, with spreads compared to high-grade muni bonds shrinking to their lowest levels since 2009.

A taxing decision?
Another reason why investors are flocking to munis has to do with the tax environment. With the top tax bracket slated to rise from 35% to 39.6% at the beginning of 2013, the after-tax yield that munis provide will be equivalent to a higher pre-tax yield. Yet right now, municipal bonds throughout the maturity curve actually yield more than Treasuries of comparable maturities. That counterintuitive state of affairs suggests that munis are still a good value compared to Treasuries despite their recent run-up.

Of course, the extra yield that muni bonds pay right now probably comes in part from concerns about risk. Several municipalities have had public problems in repaying their debt, with previously unknown areas like Jefferson County, Ala., becoming warning signs of possible mass defaults on muni bonds. Yet despite calls from Meredith Whitney that the muni market would sport a big rise in defaults, her predictions so far haven't come to pass.

Look at munis
If you need bonds in your portfolio -- and most people need at least some -- then taking a look at munis may make sense if you're in a high tax bracket. The iShares S&P National AMT-Free Muni ETF (NYSE: MUB) may make sense for some investors, but most will want to look at debt issued by their own state as well in order to take advantage of double tax-free income. Although muni bonds have the same risks of interest rate rises that regular bonds do, they represent a relative bargain for high-tax investors right now.

Muni bonds can make up a part of a smart investing plan, but they're only one piece of the puzzle. Build a more complete picture by reading The Motley Fool's special report on retirement, where you'll find three time-tested stock names that can deliver the strong long-term results you need. Don't wait -- click here and start reading your free copy right now.