In the scenario I described, the 529 administrator involved did (and still does) distinguish between the dollars contributed and the dollars earned. It’s shown on quarterly account statements, available online, and statements for each distribution show how much of the distribution is from contributions and how much is from earnings. Treating as 100% a new contribution dollars that are actually a recontribution that were originally distributed as part contribution and part earnings screws up the accounting, and without explicit guidance regarding recontributions I find it difficult to believe that the IRS expects the average taxpayer to track all of this.