Sec. 408(d)(4):
(4) Contributions returned before due date of return Paragraph (1) does not apply to the distribution of any contribution paid during a taxable year to an individual retirement account or for an individual retirement annuity if - (A) such distribution is received on or before the day prescribed by law (including extensions of time) for filing such individual's return for such taxable year, (B) no deduction is allowed under section 219 with respect to such contribution, and (C) such distribution is accompanied by the amount of net income attributable to such contribution.
Notice 2000-39 stated the earnings could be negative and that was embodied in the final regs (TD 9056, published 5/2/03).
These final regulations retain, without change, the methods provided in the proposed regulations. Thus, under these final regulations, for purposes of returned contributions under section
408(d)(4) and recharacterized contributions under section 408A(d)(6), the net income attributable to a contribution is determined by allocating to the contribution a pro-rata portion of the net income on the assets in the IRA (whether positive or negative) during the period the IRA held the contribution. This new method is represented by the following formula: Net Income = Contribution x (Adjusted Closing Balance - Adjusted Opening Balance)