The exclusion in IRC 103(a) is stated as a rule with exceptions, and the exceptions are where the surprises live. Section 103(b) disapplies the exclusion entirely for three categories, of which one reaches ordinary buyers: a private activity bond that is not a qualified bond within the meaning of section 141. A bond of that kind is issued by a governmental unit and is fully taxable, so being called a municipal bond is not by itself evidence that the interest is exempt. The other two categories, arbitrage bonds under section 148 and bonds failing the registration requirements of section 149, are compliance failures rather than a category a retail buyer chooses.
A qualified private activity bond keeps its exclusion and can still be taxed, through the alternative minimum tax. IRC 57(a)(5) makes interest on a "specified private activity bond" an item of tax preference, defined as a section 141 private activity bond issued after 7 August 1986 whose interest is excluded under section 103. Several categories are carved out of that preference, including qualified 501(c)(3) bonds under section 145 and certain housing bonds. The practical consequence is not that the alternative minimum tax is likely for most households, but that a bond marketed as tax-exempt can produce taxable income for a particular buyer, and whether it does depends on that buyer's whole return rather than on anything printed on the bond. Funds holding such bonds report the preference portion of their distributions separately for exactly this reason.
Section 103 excludes interest and stops there. A municipal bond sold for more than it cost produces a capital gain, and that gain is taxable in the ordinary way. Nothing about the exclusion reaches it. A holder who sells at a profit after a strong period for bond prices has exempt income and a taxable gain from the same security.
The market discount rule is the one a buyer is most likely to walk into without knowing it. Buying a municipal bond in the secondary market for less than its face value creates market discount, and Publication 550 states the result in one sentence: "Market discount on a tax-exempt bond is not tax exempt." Under IRC 1276(a)(1), gain on the disposition of a market discount bond "shall be treated as ordinary income to the extent it does not exceed the accrued market discount," and the IRS instructs that the accrued amount be reported as interest income rather than as capital gain. A de minimis rule keeps small discounts out of it: under IRC 1278(a)(2)(C), if the market discount is less than one quarter of one percent of the stated redemption price multiplied by the number of complete years remaining, the discount is treated as zero. Above that threshold, part of what looks like a tax-free bargain becomes ordinary income taxed at the buyer's top rate.
One naming warning goes with that. Two different de minimis rules exist in bond taxation. The MSRB's glossary defines "de minimis discount" as a rule about original issue discount, meaning a bond issued below face value. The rule a secondary-market buyer needs is the market discount rule above. Reading the first while meaning the second is easy to do and produces the wrong answer.
Tax-exempt interest is not invisible to the rest of the tax return. It is added back in full when computing whether Social Security benefits are taxable, and again when computing the income figure Medicare uses to set premium surcharges. Both of those computations are covered on their own pages, and the point to carry here is simply that buying municipal bonds to hold reported income down does not hold those two figures down at all.