Mutual funds can often serve as a useful component inside of a well-balanced investment portfolio. But they can also be a handful at tax time.

The reason: Mutual funds provide investors with two different types of capital gains that are taxable.

The first type is straightforward and can be controlled by the investor: That is the gain realized when the investor sells shares of the mutual fund at a higher price than when they were purchased.

The second, however, is not as controllable. Those are the annual capital-gain distributions, which open-ended mutual funds are required to pay out in the year of their realization.

What’s more, the cost basis for these distributions does not reflect an investor’s purchase price. Instead, they are based on the fund’s internal purchases of given securities. As a result, it is possible for an investor to have to pay taxes on gains that he never experienced.

The most egregious example is when an investor purchases a fund today for $100 a share, and the fund then makes a $20 capital-gain distribution the following day. The net asset value of the fund drops by a corresponding $20, to $80 a share – which means the investor must pay capital gains taxes on a portion of his own contributed principal.

If it all sounds very convoluted, that’s because it is. But there’s a trick here that can help you understand things more clearly: Before buying into a mutual fund, check on the fund’s distribution dates. Then, buy after, not immediately before, the distribution.

A certified financial planner professional with expertise in investment management can advise you on the tax implications of mutual funds. He or she can help you not only with your asset allocation in a portfolio of funds, but also with “asset location.” This involves determining which funds to put into your taxable accounts, and which are better held in your tax-deferred accounts, as part of an overall strategy to maximize your after-tax returns.