Stocks continue be the best way to build wealth over time, but that doesn't mean bonds don't have a place in your portfolio. The advantage of bonds is that their values tend to fluctuate less frequently and drastically than stock values while still offering some income in the form of interest paid.

Treasury bonds and corporate bonds tend to get the lion's share of attention, but municipalities such as states, cities, and counties issue bonds, too. There's a large market for investing in municipal bonds, or "muni" bonds. And, just like their corporate and federal government counterparts, there are plenty of good reasons to add municipal bonds to your portfolio.

map of United States of America with states outlined and labeled

Image source: Getty Images.

Here's what you need to know about investing in municipal bonds.

How municipal bonds work

A municipal bond is a debt issued by a state or municipality to fund public works. Like other bonds, investors lend money to the issuer for a predetermined period of time. The issuer promises to pay the investor interest over the term of the bond (usually twice a year) and then return the principal back to the investor when the bond matures.

For example, if you invest $5,000 in a 10-year municipal bond paying 4% interest, you've loaned $5,000 for 10 years. In return, the municipality will pay you $200 per year in interest -- typically paid in biannual installments -- and then return your $5,000 at maturity.

This is why bond values are usually more stable than stocks. The value is easy to calculate: You add up the bond's face value and the interest it will pay. The main thing that affects the value of a bond is the interest rate. A bond that pays a higher interest rate than a new issue -- meaning brand-new bonds just coming up for sale -- is worth more money, while a bond that pays a lower interest rate than a new issue is worth less money. That's because the price you could sell the bond or buy it for is adjusted up or down based on current available yields.

Types of municipal bonds

Municipal bonds come in two varieties: general obligation and revenue bonds. General obligation bonds are used to finance public projects that aren't linked to a particular revenue stream. Revenue bonds, by contrast, are used to finance public projects with the potential to generate revenue. There are advantages and drawbacks to investing in each type.

General obligation bonds

General obligation bonds are used to fund public projects, such as building a park or improving a school system, that don't inherently make money but better the communities they serve. General obligation bonds are backed by the full faith and credit of the issuer, meaning they're not secured by any specific asset bondholders can repossess. As such, general obligation bonds have been one of the safest kinds of bonds you could buy.

Revenue bonds

Revenue bonds are issued by municipalities to finance revenue-generating projects like a toll road or concert hall. The cash generated by the project itself will pay back investors in those bonds. Revenue bonds have higher default rates than general obligation bonds since the funds are used for a specific project, which may or may not be completed on time and within budget and may not generate the projected revenues. So it's important to research the issuer's credit rating before risking your capital.

How to invest in municipal bonds

There are three ways to invest in municipal bonds:

  • New issue
  • Secondary market
  • Bond funds

New issues are bonds that a municipality sets up for a new project. The secondary market is where you can buy bonds that are already issued from other investors or sell not-yet-matured bonds you already hold. Bond funds are investments in a fund that owns bonds. You own a stake in the bonds via your ownership of that fund.

In all of these cases, you'll buy and sell through a broker, similar to how you invest in stocks. It's important to understand the fees you'll pay, as well as the potential "markup" -- a selling price above face value -- of the bond.

Brokers who buy and sell municipal bonds are required to register with the Municipal Securities Rulemaking Board (MSRB), which governs the muni bond market. They're required to disclose certain pricing information so that you, as an investor, can understand what you're paying.

A mutual fund or exchange-traded fund (ETF) that invests in bonds might be appropriate as well. Your investment in a muni bond fund gives you a small stake in every municipal bond the fund owns. The benefit is instant diversification, which can help you avoid losses from being too exposed to a single bond. The downside is potentially high recurring fund management fees.

Benefits and risks of municipal bonds

On the whole, municipal bonds have a low default rate. Between 1970 and 2015, there were only 99 muni bond defaults issued. Of these, only nine general obligation bonds defaulted, and not a single municipal bond with the highest credit rating defaulted. Municipal bonds have been 50 to 100 times less likely to default than corporate bonds.

However, municipal bonds still are not risk-free. In recent years, some governments have defaulted on their municipal bonds, including Detroit in 2013 and Puerto Rico in 2016.

Municipal bonds generally offer lower interest rates than corporate bonds, although, as with Treasury bonds, that interest is tax-free. (Keep in mind, however, that the tax benefits of municipal bonds only apply to interest payments -- not capital gains. If you sell a bond for more than you paid, those gains are still taxable.)

Muni bonds carry "interest rate risk" as well. If interest rates go up while you still own a particular muni bond, you will earn a lower yield than you'd be able to attain from a new issue in the future. Interest rate changes will affect the value of your bonds on the secondary market, too. If you have to sell a bond in the future, you may have to sell it below redemption value to compensate for the lower yield if rates go up.

Municipal bond rates

There are three major ratings agencies that rank bond issuers based on their likelihood of meeting their financial obligations versus defaulting on them. They are S&P Global (NYSE:SPGI), Moody's (NYSE:MCO), and Fitch.

Generally, the higher an issuer's credit rating, the lower the interest rate its bonds pay. Conversely, issuers with a lower rating generally must offer higher interest rates to offset their associated risk. But remember that bond ratings can change. Just because an issuer starts out with a strong rating doesn't mean it can't get downgraded if its financial circumstances change.

Muni bonds have a high rate of recovery even when they default, but your capital can be tied up longer than the term of the bond, and investors rarely recoup interest not paid. So be sure to consider all the implications when considering which municipal bonds to buy.

Municipal bonds versus corporate bonds

Municipal bonds differ from corporate bonds in the tax treatment of the interest they pay, and they also have lower default rates. This is why municipal bonds generally pay lower yields than similar corporate bonds. Additionally, muni bonds generally require a $5,000 minimum investment while corporate bonds start at $1,000.

In short, the risk-reward profile for munis and corporate bonds is different. If less risk is your priority, munis come out ahead; if better yields with higher risk suits you, corporate bonds get the nod.