Capital gains taxes are assessed on nominal gains not real gains.
If I bought $100K of stock in 1999 and sold it in 2026 for $200K, I gained no real wealth from that transaction. What I could purchase today for $200K could have been bought for $100K in 1999 because of inflation.
Yet, I’d owe capital gains on the $100K of nominal gain I experienced. This is part of the reason that long-term capital gains are taxed at a lower rate than ordinary income.