(a) In general
Section 529(c)(3) of the Internal Revenue Code of 1986 is amended by adding at the end the following new subparagraph:
(F) Special rule for certain distributions from long-term qualified tuition programs for first home purchases
(i) In general In the case of a distribution from a qualified tuition program of a designated beneficiary which has been maintained for the 15-year period ending on the date of such distribution, subparagraph (A) shall not apply to so much of the portion of such distribution which—
(I) does not exceed the aggregate amount contributed to the program (and earnings attributable thereto) before the 5-year period ending on the date of the distribution, and
(II) is used, within 60 days of such distribution, for the purchase of a principal residence of a first-time homebuyer who is such designated beneficiary.
(ii) Aggregate limitation This subparagraph shall not apply to any distribution described in clause (i) to the extent that the aggregate amount of such distributions with respect to the designated beneficiary for the taxable year and all prior taxable years exceeds an amount equal to $35,000, reduced by the aggregate amount of distributions to which subparagraph (E) applies with respect to such designated beneficiary for such taxable year and all prior taxable years.
(iii) Special rule where delay in acquisition If any distribution from a qualified tuition program of a designated beneficiary fails to meet the requirements of subparagraph (A) solely be reason of a delay or cancellation of the purchase or construction of the residence, the amount of the distribution may be contributed to a qualified tuition program or ABLE account of such beneficiary, as provided in subclauses (I) and (III), respectively, of subparagraph (C)(i), determined by substituting 120 days for 60 days in such subparagraph, except that—
(I) subparagraph (C)(iii) shall not be applied to such contribution, and
(II) such amount shall not be taken into account in determining whether subparagraph (C)(iii) applies to any other amount.