The distribution is not a policy choice, which is the part that explains everything else. A regulated investment company is spared tax at the fund level only on what it actually hands to its shareholders, and two separate provisions enforce that. IRC 852(a)(1) conditions the whole pass-through regime on the fund distributing at least 90 percent of its investment company taxable income, a figure computed without regard to capital gain dividends, so that test governs the fund's ordinary income rather than its gains. What pushes the gains out is IRC 852(b)(3)(A), which imposes a corporate-level tax on the fund's net capital gain to the extent it is not paid out as capital gain dividends. A fund that keeps its realized gains is taxed on them.
There is a third route, and it makes the point sharper rather than weaker. Under IRC 852(b)(3)(D) a fund may retain the gain, pay that tax itself, and designate the amount to its shareholders, who then have to include it in their own long-term capital gains anyway, take a credit for the tax the fund paid, and increase the basis of their shares by the difference. So the gain reaches the shareholder whether it is distributed or kept. When the portfolio manager sells an appreciated holding, the destination of the resulting gain is fixed by statute, and that destination is the shareholders.
Managers sell for ordinary reasons that have nothing to do with any individual shareholder: meeting redemptions from other investors who are leaving, rebalancing, a change in the index the fund tracks, a takeover of a holding, or a strategy that simply turns over. In a year when a fund has fallen, sales made for any of those reasons can still realize gains on positions bought long ago at much lower prices. That is how a fund you are holding at a loss can hand you a taxable gain, and it is a mechanical consequence rather than mismanagement.
The character of the distribution is fixed, and fixed in the direction most people do not expect. IRC 852(b)(3)(B) provides that a capital gain dividend "shall be treated by the shareholders as a gain from the sale or exchange of a capital asset held for more than 1 year." Long-term, always, whatever your own holding period. Someone who bought the fund three weeks ago receives long-term treatment on the distribution, which is favorable. The corollary is that this is one of the few places where a short holding period costs you nothing in character, and it is also why a large distribution cannot be turned into a short-term item by selling quickly.
The character is set by the fund's own designation. Under 852(b)(3)(C) a capital gain dividend is what the company reports as one, and where a fund reports more than its actual net capital gain the excess is reallocated by formula, so the reported figure is subject to correction rather than being simply whatever the fund says.
The share price falls by the amount distributed, and this is the fact that makes the tax feel unjust. A distribution moves money from inside the fund to the shareholders, so the fund's net asset value per share drops by the amount paid out on the day it goes ex-distribution. A shareholder who takes the cash is left with a lower-priced share plus the cash. One who reinvests owns more shares at the lower price. In both cases the total is unchanged, and in a taxable account there is now tax to pay on it. Nothing was gained on the day and a liability was created.
Buying shortly before a distribution is therefore worth avoiding in a taxable account, and it is a genuine trap rather than a technicality. The distribution goes to whoever holds shares on the record date, and the gains being distributed accrued while other people owned the fund. Because these payouts cluster late in the calendar year, buying in November or December can produce a tax bill within weeks of investing, on gains you did not participate in. Fund companies publish estimated distribution amounts and dates ahead of the event, which is what makes the timing checkable rather than a matter of luck.
Two things narrow the problem considerably. Inside an IRA, a 401(k) or any other tax-advantaged account, distributions are not taxable events at all, so none of this applies. And reinvesting the distribution, while it does not defer the tax, does add the reinvested amount to your basis, so you are not taxed on the same money again when you eventually sell.