Democrats’ talk of higher taxes for the rich might intensify interest in state and local government bonds, where income is often exempt from taxes.

Tax-loss harvesting in municipal bond portfolios can allow investors to offset tax liabilities stemming from capital gains in other asset classes—as long as investors and advisors do their homework.

“Basically, when rates go up investors will potentially experience capital losses on munis—and that’s when tax-loss harvesting gets powerful and interesting,” said Alex Etzkowitz, vice president of investment research and strategy at Gurtin Municipal Bond Management in Solana Beach, Calif. “Investors can swap into other bonds, lock into the same amount of income and actually take advantage of losses to offset gains elsewhere. This is unlike tax-loss harvesting with equities, ETFs and mutual funds, which simply defers payments of taxes into the future and effectively postpones the capital gains tax burden.”

In a simple example, your client purchases a municipal bond at $120 that is now priced in the marketplace at $110. He or she realizes a $10 loss on the sale and reinvests into a similar security with an identical maturity date, priced at $110. When the bonds mature, there are no capital gains because the purchases were executed above par. But the client has locked in a $10 capital loss that can be used to offset other gains realized through other investments.

Historically, muni bonds have outperformed Treasurys after the hiking of top marginal tax rates. “For top taxpayers, municipal bonds should be a core piece of an overall asset allocation,” Etzkowitz said.

High-earning individuals are often better positioned to realize the most benefit from tax-free municipal bonds, said Jim Barnes, director of fixed income at Bryn Mawr Trust in Bryn Mawr, Pa., especially after tax reform introduced limitations on such long-standing deductions as state and local tax and property (SALT) tax.

Muni bonds have become desirable to wealthy investors in high-tax states such as California and New York, where the limitation on the SALT deduction hit hardest.

“We have a few clients in which we do manage a tax-free bond mutual fund portfolio for them in their taxable accounts and we’re able to generate fairly comparable yields after taxes to stocks and other taxable bond portfolios,” said Bruce Primeau, president of Summit Wealth Advocates in Prior Lake, Minn. He cited the example of managing a portfolio that is 55 percent stocks and 45 percent bonds for a couple that lives in Texas, which has no state income tax. “They do have about $1 million in tax-deferred accounts, but several million dollars in a taxable joint account,” he said. “We have to manage a bond component in their taxable account to keep their overall asset allocation in line. In their case, we own a few different municipal bond mutual funds to construct a short-to-intermediate municipal bond portfolio for them, and it’s been generating a little over 2 percent after-tax return for them each year.”

The market comes with potholes. “The municipal bond market is thin and not efficient for trading,” said William Velekei, a CPA and financial advisor with Corbenic Partners in Bethlehem, Pa. “Investors have more attractive pricing trading larger bond lots than those who trade smaller lot sizes. One strategy we recommend is building out and owning individual bonds in a laddered portfolio. It hedges against the risk of rising interest rates by reinvesting maturing bond proceeds, and it diversifies the holdings of the individual bonds across multiple issuing agencies.”

Velekei’s firm has clients who live in states that have above-average state income tax rates. “This strategy gives us the flexibility to customize a municipal bond portfolio that not only maximizes the benefit at a federal tax level but also at the state income tax level,” he said.

But he had one note of caution: “Municipal bonds are often thought of as safe and conservative. The majority are. But individuals should be aware that not all states, municipalities or agencies have the same credit quality,” Velekei said.