I continue to come across this odd fact about mutual fund investing, but I never understood how it works. Let's say I decided to invest in ABC fund the day before year-end distributions. At the beginning of the year, NAV was $10 per share. Then, a year later, NAV increased to $100 per share. At that point, I invest $100,000 at $100 per share. So, now I own 1000 shares of ABC fund. When distributions are calculated, I discover that the NAV or none of the underlying prices have changed since the day prior such that if I had invested in these shares individually, there would have been no gain/loss. Nevertheless, I receive the distributions (and pay taxes on) the gain earned in the fund throughout the entire year, which is 900%. Assuming for the sake illustration that the fund turns over entire holdings, how exactly would this work and what would be my capital gains at this point?
The premises of the OP's question have several misconceptions that make the conclusions drawn by the OP incorrect. Let us take the basic numbers, unbelievable though they are, as correct: at the beginning of the year, the mutual fund shares had an NAV of $10/share and on the day before the fund declares a distribution, the NAV was $100/share. Typically, much of the increase in NAV is due to increases in the market price of the mutual fund's holdings, and a relatively small amount is due to the mutual fund's activities. That is, it would be an unbelievably rare case that the mutual fund would pay a distribution of $90 per share the next day.
As the OP correctly states, the mutual fund bought and sold the stocks/bonds in its holdings throughout the year, so the fund had capital gains or losses from these activities. The fund also collected dividends paid by the stocks that it held and/or interest paid by the bonds that it held. These items are paid out as distributions to the share holders, categorized as net long term gains, net short-term gains, and dividends, categorized these days into qualified dividends (dividends from stocks) and non-qualified dividends (interest from bonds). For example, in December 2019, Vanguard Explorer Fund had a NAV of a little over $100 per share, but declared a dividend of only $0.2949 per share and long-term capital gains of $4.8967 per share. Net losses are retained by the fund to offset future capital gains (cf. this answer or this one). It doesn't matter whether the mutual fund turned over its entire portfolio once or twice or twenty times or not at all; the distribution amount is determined by the realized gains and losses by the mutual fund's activities, and not by the unrealized gains due to market movement of the prices of the underlying investments. In short, the OP's dreams of getting a $90 per share distribution because the NAV increased from $10/share to $100/share are likely to remain a pipe dream.
As aganju points out in another answer, it is a bad idea to buy a mutual fund just before it declares a distribution (in a taxable account). This is called "buying a dividend" because the distribution is a taxable event (the OP will owe taxes on the amounts distributed regardless of whether the OP receives the distribution in cash or chooses to re-invest it in the same fund (or a different fund). If the OP receives a $5 per share distribution in cash ($5K total), the mutual fund's NAV will drop to $95, and those 1000 shares will be worth only $95,000; that is, the distribution will have no effect on how much money the OP has. If the $5000 distribution is re-invested into the same mutual fund, the OP will now own 1000+5000/95 = 1052.63157... shares priced at $95/share for a total value of $100,000. In either case, the OP has incurred $5000 in taxable income. If the OP had kept her purse shut for just one more day, she could have bought 1052.63157 shares of the fund with her $100,000 after the distribution was declared and no taxable income of $5000 would have resulted. That's why buying shares just before a distribution is declared is not a very good idea. Most mutual fund companies that make distributions in December post estimates of the per-share distributions on their websites by late October or November, and usually have recommendations suggesting that investors not invest in the funds in the days leading up to the day when the fund declares a dividend.
What about the other scenario envisioned by the OP in comments below this answer:
The share price stayed at $10/share all through the year but the mutual fund sold and bought many securities through the year and is now holding a huge amount of capital gains. Can I get some part of these gains by investing $100K (thus getting 10,000 shares) the day before the announced distribution?
Once again, the premises are faulty. First, the NAV of the mutual fund's shares is determined each evening by adding up the total value of all the securities held (using that day's market closing prices of the securities) plus all cash on hand. Almost all mutual funds have a "bank account" (sort of like a petty cash account) into which all new investment money is deposited until the fund manager decides what securities to buy with that new money, and from which all redemptions of shares are paid out, and from which the daily expense fee is paid out to the fund management etc.). So, if the mutual fund has a "ton of gains", that ton of money is either sitting in the "bank account" (very unlikely) or (more likely) invested in more securities until distribution day rolls around. Either way, the NAV would be more than $10/share, and would fall by exactly the distribution per share paid out when the distribution is declared (assuming no change in the price of the underlying securities from the previous day). So, yes, assuming the NAV is $10 in the day before the distribution, the OP can buy 10,000 shares for her $100K, but if the next day, the mutual fund declares a distribution of $2 per share, its NAV will be $8, and while she will getting a check for $20K soon (taxable income!), her 10,000 shares will be worth only $80K. Practically, what will happen is that the mutual fund will just send back $20K from the $100K cash she invested the previous day and so is still sitting in the "bank account" most likely, and will record her as the owner of 10,000 shares she bought (purchase price $10/share). If she tries to redeem those shares the next day, they will be worth $80K only, and that's how much money she would get as the proceeds of the redemption. In short, this is not a quick way to make a buck, but instead a quick way of unnecessarily creating taxable income on which tax will be due soon without any change in wealth.
Buying a fund or an ETF directly before the dividend payment date has the same effect as buying an individual share right before its dividend payment - you get a dividend that is taxable for that calendar year, and the investment price drops by the dividend amount.
Both are similarly bad ideas - unless you love paying taxes, or you are in a special situation (for example, you have larger losses from other investments that you couldn’t deduct), it is typically a poor decision.
Simply watch out for the dividend pay day when you buy significant amounts of shares, funds, or whatever.
Note that if you hold the investment sixty days after the dividend (or bought it sixty days before), the dividend will count as long-term gains.