Except as otherwise provided in this paragraph, the credit allowed under subsection (a) shall not exceed $8,000.
In the case of a married individual filing a separate return, subparagraph (A) shall be applied by substituting “$4,000” for “$8,000”.
If two or more individuals who are not married purchase a principal residence, the amount of the credit allowed under subsection (a) shall be allocated among such individuals in such manner as the Secretary may prescribe, except that the total amount of the credits allowed to all such individuals shall not exceed $8,000.
In the case of a taxpayer to whom a credit under subsection (a) is allowed by reason of subsection (c)(6), subparagraphs (A), (B), and (C) shall be applied by substituting “$6,500” for “$8,000” and “$3,250” for “$4,000”.
No credit shall be allowed under subsection (a) with respect to the purchase of any residence unless the taxpayer has attained age 18 as of the date of such purchase. In the case of any taxpayer who is married (within the meaning of section 7703), the taxpayer shall be treated as meeting the age requirement of the preceding sentence if the taxpayer or the taxpayer’s spouse meets such age requirement.
The term “principal residence” has the same meaning as when used in section 121.
A person shall be treated as related to another person if the relationship between such persons would result in the disallowance of losses under section 267 or 707(b) (but, in applying section 267(b) and (c) for purposes of this section, paragraph (4) of section 267(c) shall be treated as providing that the family of an individual shall include only his spouse, ancestors, and lineal descendants).
In the case of an individual (and, if married, such individual’s spouse) who has owned and used the same residence as such individual’s principal residence for any 5-consecutive-year period during the 8-year period ending on the date of the purchase of a subsequent principal residence, such individual shall be treated as a first-time homebuyer for purposes of this section with respect to the purchase of such subsequent residence.
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 (2) 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) to the extent not previously recaptured under paragraph (1).
Paragraph (2) 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 (2). Paragraph (2) 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.
In the case of any taxpayer who enters into a written binding contract before May 1, 2010, to close on the purchase of a principal residence before July 1, 2010, and who purchases such residence before October 1, 2010, paragraph (1) shall be applied by substituting “October 1, 2010” for “May 1, 2010”.