L3 - tax deferred account question

Would someone explains why the tax deferred account gets a tcg added back in this example? I thought for TDA it’s FVIFtda = (1 + r)^n*(1 – Tn) since the money in the account is tax deductible to begin with, so when it’s taxed it would be taxed the whole amount? why do cfai separates cost basis from capital gain to calculate return here (which is equivalent to a taxable account but tax is deferred to the very end so you would add back the tax on capital gain because money in the account already taxed in the beginning)?

This is one of the 20 mock Q

Louis asks Cheng to explain how some of his investments are performing. Three of his accounts
are shown in Exhibit 2. All three derive their returns from current income (i.e., no net unrealized
capital gains or losses). After five years, Louis plans to liquidate the three accounts and purchase
an annuity with the proceeds.
Exhibit 2
Selected Accounts of Louis Bray
Account Current Value/Tax Basis Nominal Return Standard Deviation
Tax-exempt $1 million 6% 10%
Taxable $1 million 10% 13%
Tax-deferred $1 million 9% 12%
C. Identify which of the accounts will have the smallest and the largest after-tax return and
which accounts exhibit the lowest and highest risk over the next five years.

Tax-deferred: $1 million x (1.09)5 = $1,538,624 – $1 million basis =
$538,624 gain x (1 – 0.30) = $377,037 + $1 million basis = $1,377,037

Same topic here: