This is really an extended comment on the last paragraph of @BenMiller's answer.
When (the manager of) a mutual fund sells securities that the fund holds for a profit, or receives dividends (stock dividends, bond interest, etc.),
the fund has the option of paying taxes on that money (at corporate rates) and distributing the rest to shareholders in the fund, or passing on the entire amount (categorized as dividends, qualified dividends, net short-term capital gains, and net long-term capital gains) to the shareholders who then pay taxes on the money that they receive at their own respective tax rates. (If the net gains are negative, i.e. losses, they are not passed on to the shareholders. See the last paragraph below). A shareholder doesn't have to reinvest the
distribution amount into the mutual fund: the option of receiving the money as cash always exists, as does the option of investing the distribution into a different mutual fund in the same family, e.g. invest the distributions from Vanguard's S&P 500 Index Fund into Vanguard's
Total Bond Index Fund (and/or vice versa). This last can be done without
needing a brokerage account, but doing it across fund families will
require the money to transit through a brokerage account or a personal
account. Such cross-transfers can be helpful in reducing the amounts of
money being transferred in re-balancing asset allocations as is
recommended be done once or twice a year. Those investing in
load funds instead of no-load funds should keep in mind that
several load funds waive the load for re-investment of distributions
but some funds don't: the sales charge for the reinvestment is
pure profit for the fund if the fund was purchased directly or passed
on to the brokerage if the fund was purchased through a brokerage
account.
As Ben points out, a shareholder in a mutual fund
must pay taxes (in the appropriate categories) on the distributions
from the fund even though no actual
cash has been received because the entire distribution has been
reinvested. It is worth keeping in mind that when the mutual
fund declares a distribution (say $1.22 a share), the Net Asset Value
per share drops by the same amount (assuming no change in the
prices of the securities that the fund holds) and the new shares
issued are at this lower price. That is, there is no change in
the value of the investment: if you had $10,000 in the fund
the day before the distribution was declared, you still have
$10,000 after the distribution is declared but you own more shares
in the fund than you had previously. (In actuality, the new shares
appear in your account a couple of days later, not immediately when
the distribution is declared). In short, a distribution from
a mutual fund that is re-invested leads to no change in your
net assets, but does increase your tax liability. Ditto for a distribution that is taken as cash or re-invested elsewhere.
As a final remark, net capital losses inside a mutual fund are
not distributed to shareholders but are retained within the
fund to be written off against future capital gains. See also
this previous answer
or this one.