Nobody likes paying taxes on profits. But there's one thing that's even worse: paying taxes when you've lost money.

Yet that's exactly the situation some fund investors are likely to face in 2008. Even with fund prices falling along with the malaise in the markets, built-in capital gains are poised to rear their ugly heads later this year -- and that could spell a big tax bill next year.

The backwards thinking of fund taxation
The great thing about stock investing is that for the most part, you get to pick when you pay taxes. As long as you hold on to your shares, you don't have to pay any tax on your gains. When you decide to sell, that's when the tax bill comes due -- but when to sell is entirely your decision to make.

Not so with fund shares. Not only will you pay tax on gains if you sell your fund shares, but you can also end up on the hook for capital-gains taxes even if you don't do anything at all. That's because when the fund itself sells some of its holdings, it's required by law to pass on any gains to its shareholders. That leaves you holding the bag when funds cash in on profitable positions -- even if the fund loses money during that year.

Lots of built-in gains
Despite losses in recent months, many funds are sitting on gains from the bull market that started back in 2002. For instance, Vanguard's Capital Opportunity Fund, which has provided annual returns of more than 19% over the past five years, already has realized more than $1 per share of gains so far in 2008 -- and it has almost $9 per share more in unrealized gains from holdings such as Research In Motion (Nasdaq: RIMM), FedEx (NYSE: FDX), and Arch Coal (NYSE: ACI).

Similar tax problems are likely to plague investors in international markets. Vanguard's International Growth Fund, for example, has already accumulated almost 2% of its net asset value in realized gains in the first two months of the year. Unrealized gains from investments such as Rio Tinto (NYSE: RTP), Teva Pharmaceuticals (Nasdaq: TEVA), and Petroleo Brasileiro (NYSE: PBR) add up to 15% of net asset value -- a huge potential tax liability for investors.

What to do
The primary question fund investors should ask is whether their funds are likely to liquidate their profitable stock positions and thereby trigger capital-gains tax liability. For passive index funds, the answer is probably no. Unless investors make massive redemptions of shares and force fund managers to liquidate stocks to pay them off, most index funds hang on to their holdings for the long run. Actively managed funds, on the other hand, often need to sell profitable positions to generate cash for new investment ideas.

You can do several things to avoid the bite of mutual fund capital gains. One is to stick with exchange-traded funds and index funds that are relatively tax-efficient. For instance, Vanguard's 500 Index Fund has a huge built-in gain -- but it's unlikely to have to distribute any of those gains. Another solution is to buy mutual funds in IRAs and other tax-favored accounts, where taxation isn't an issue.

If you already own shares of a fund that's gone up in price, there may not be a whole lot you can do. Congress has proposed changing mutual fund tax laws to allow you to defer gains until you sell your fund shares. But unless this legislation passes -- and it's a long shot in an election year in which tax revenue is at a premium -- you can expect to see those annoying taxable distributions in your fund statements at the end of the year.

For more on fund investing during challenging times, read about:

To learn more about handling taxes on your mutual funds, read The Motley Fool's Champion Funds newsletter service. You'll find specific fund recommendations that keep costs and taxes in mind, along with helpful analysis to make fund investing easier. Check it out free for 30 days with a trial subscription.

Fool contributor Dan Caplinger pays his taxes, even if he doesn't always like doing it. He owns shares of Vanguard's International Growth Fund. FedEx is a Motley Fool Stock Advisor recommendation, and Petroleo Brasileiro is an Income Investor pick. The Fool's disclosure policy tells it like it is.