Selling a fund down $12,000 and immediately buying a different fund tracking a similar but not identical index keeps the investor in the market while creating a $12,000 realised loss to offset gains elsewhere.
The benefit is deferral, not elimination. The replacement carries a lower cost basis, so a larger gain is due eventually. The value is the time value of the deferred tax plus any difference between the rate saved now and the rate paid later, which makes harvesting most useful for those expecting a lower future rate or planning to donate or bequeath the position.
The constraint is the wash-sale-rule, which disallows the loss if a substantially identical security is bought within the prescribed window around the sale, including in a spouse's or retirement account. Harvesting inside a tax-advantaged-account achieves nothing.
Related: wash-sale-rule, tax-advantaged-account, cost-basis-method, direct-indexing, tax-aware-rebalancing, asset-location