26 USC 75 - Dealers in tax-exempt securities

(a) Adjustment for bond premium 
In computing the gross income of a taxpayer who holds during the taxable year a short-term municipal bond (as defined in subsection (b)(1) primarily for sale to customers in the ordinary course of his trade or business
(1) if the gross income of the taxpayer from such trade or business is computed by the use of inventories and his inventories are valued on any basis other than cost, the cost of securities sold (as defined in subsection (b)(2) during such year shall be reduced by an amount equal to the amortizable bond premium which would be disallowed as a deduction for such year by section 171 (a)(2) (relating to deduction for amortizable bond premium) if the definition in section 171(d) of the term bond did not exclude such municipal bond; or
(2) if the gross income of the taxpayer from such trade or business is computed without the use of inventories, or by use of inventories valued at cost, and the municipal bond is sold or otherwise disposed of during such year, the adjusted basis (computed without regard to this paragraph) of the municipal bond shall be reduced by the amount of the adjustment which would be required under section 1016 (a)(5) (relating to adjustment to basis for amortizable bond premium) if the definition in section 171(d) of the term bond did not exclude such municipal bond.

Notwithstanding the provisions of paragraph (1), no reduction to the cost of securities sold during the taxable year shall be made in respect of any obligation described in subsection (b)(1)(A)(ii) which is held by the taxpayer at the close of the taxable year; but in the taxable year in which any such obligation is sold or otherwise disposed of, if such obligation is a municipal bond (as defined in subsection (b)(1)), the cost of securities sold during such year shall be reduced by an amount equal to the adjustment described in paragraph (2), without regard to the fact that the taxpayer values his inventories on any basis other than cost.

(b) Definitions 
For purposes of subsection (a)
(1) The term municipal bond means any obligation issued by a government or political subdivision thereof if the interest on such obligation is excludable from gross income; but such term does not include such an obligation if
(A) 
(i) it is sold or otherwise disposed of by the taxpayer within 30 days after the date of its acquisition by him, or
(ii) its earliest maturity or call date is a date more than 5 years from the date on which it was acquired by the taxpayer; and
(B) when it is sold or otherwise disposed of by the taxpayer
(i) in the case of a sale, the amount realized, or
(ii) in the case of any other disposition, its fair market value at the time of such disposition, is higher than its adjusted basis (computed without regard to this section and section 1016 (a)(6)).

Determinations under subparagraph (B) shall be exclusive of interest.

(2) The term cost of securities sold means the amount ascertained by subtracting the inventory value of the closing inventory of a taxable year from the sum of
(A) the inventory value of the opening inventory for such year, and
(B) the cost of securities and other property purchased during such year which would properly be included in the inventory of the taxpayer if on hand at the close of the taxable year.