of taxpayers for the credit allowable by this section, the exception provided by section 6045(e) shall not apply. (f) Recapture of credit (1) In general Except as otherwise provided in this subsection, if, during any taxable year before the close of the recapture period, a taxpayer disposes of the principal residence with respect to which a credit was allowed under subsection (a) (or such residence ceases to be the principal residence of the taxpayer), the tax imposed by this chapter for such taxable year shall be increased by the recoverable amount determined in paragraph (2). (2) Recoverable amount For purposes of paragraph (1), the recoverable amount is the product of— (A) 25 percent of the amount of the credit allowed under subsection (a), multiplied by (B) the number of taxable years remaining in the recapture period as of the beginning of the taxable year in which the taxpayer disposes of the principal residence. (3) Limitation based on gain In the case of the sale of the principal residence to a person who is not related to the taxpayer, the increase in tax determined under paragraph (1) shall not exceed the amount of gain (if any) on such sale. Solely for purposes of the preceding sentence, the adjusted basis of such residence shall be reduced by the amount of the credit allowed under subsection (a). (4) Exceptions (A) Death of a taxpayer Paragraph (1) shall not apply to any taxable year ending after the date of the taxpayer’s death. (B) Involuntary conversion Paragraph (1) shall not apply in the case of a residence which is compulsorily or involuntarily converted (within the meaning of section 1033(a)) if the taxpayer acquires a new principal residence during the 2-year period beginning on the date of the disposition or cessation referred to in paragraph (1). Paragraph (1) shall apply to such new principal residence during the recapture period in the same manner as if such new principal residence were the converted residence. (C) Transfers between spouses or incident to divorce In the case of a transfer