"The question was how does IRS know if you fund TIRA w/ after tax money and that this is not a taxable event."
It is up to you to keep track of any after-tax contributions. Form 8606.
Better have great record-keeping procedures, because the time-span between the contribution and the withdrawal may be decades apart.
But the killer is the pro-ration rules for the withdrawals.
Say your total IRA balances are $200,000 and over the years you've made $10,000 after-tax contributions.
The logic is, you paid tax on the $10,000 when you put it in, so you shouldn't have to pay tax when you take it out.
Now you want to withdraw $8000.
You would like to say, "That $8000 comes from the $10,000 I put in after-tax." Like the way you can choose tax-lots when you sell stock.
Can't do that. The IRS says that your withdrawal are prorated among the taxable and non-taxable portions. 10,000/200,000 (5%) is nontaxable and the rest is taxable.
Of your $8,000 withdrawal, $400 is tax-free and $7,600 is taxed.
Next year, the IRA balance has grown back to $200,000 but now $9,600 is after-tax. ($10K minus $400).
You go to withdraw another $10,000.
The nontaxed amount is 9,600/ 200,000 (4.8%) of $10,000, or $480. Your new after-tax balance is $9,120.
And so it goes, Each year a smaller and smaller portion of your withdrawal is non-taxable.
You *never* get to the point where you have recovered all of your after-tax contributons as non-taxed withdrawals -- until you've withdrawn every last penny from all your IRAs.
Worse yet, if you have been very successfully investing and you IRAs total $400,000 instead of merely $200,000, the first-year ratio is 10,000/400,000 or 2.5%. So only $240 of your $10,000 withdrawal is tax-free.