Index funds are excellent, low-cost ways to invest, but they're only as good as the indexes they track. Which stocks get into an index, and which stocks are left out, is generally determined by a set of simple mechanical rules -- rules that are set in stone, unless someone makes a mistake.

As it turns out, making a mistake is apparently easier than it might appear.

The Russell 2000 Index, which is broadly understood to be the small-cap stock index, has a few requirements that determine which stocks make the cut. For example, it requires that companies have a total market cap of $30 million or more in order to eliminate really small companies. It also requires that more than 5% of a company's shares outstanding are available to buy and sell on an exchange at any time -- this is known as a stock's "float."

Cartoon man shooting arrows while wearing a blindfold

Image source: Getty Images.

Indexes are supposed to track the market, not move the market, so these restrictions help ensure that Russell 2000 index funds don't drive stock prices up or down when stocks are added or removed from the portfolio. The requirements for inclusion work well, but only when the rules are followed.

What happens when rules get broken

Enter LongFin Corp (LFIN), which is a closely held company that went public by listing only about 2.5% of its shares on a stock exchange. This means that only a very small percentage of the stock's shares can trade hands, so it shouldn't qualify for inclusion into the Russell indexes because of its small stock float.

FTSE, which owns the Russell indexes, erroneously calculated how much of LongFin's stock traded on public markets, thus allowing the stock into its indexes when it shouldn't have. 

LongFin was officially added to the Russell 2000 and Russell 3000 indexes on March 22. But speculators who try to profit by front-running index funds by buying stocks before they are added to the index, as well as index funds that buy stocks before they are officially added to an index so as to avoid moving the market, had already started to drive LongFin's share price higher and higher. 

Candlestick chart for LongFin Corp.

Data source: Google Finance. Chart by author.

From the stock chart, it's pretty easy to see when this index-related buying activity began (about a week before LongFin was officially a member of the Russell indexes) and when it reversed (almost immediately after inclusion on March 22).

"Oops!"

Four days after LongFin officially joined its indexes, FTSE admitted that it made an error and would delete LongFin from its indexes after the close on March 28. Thus, all the index funds that piled into LongFin Corp stock now had to rush back out. Ordinarily, this wouldn't be a problem because a low-float, thinly traded stock usually wouldn't be allowed in an index in the first place.

But because LongFin is a low-float, thinly traded stock, its six-day stay in the Russell 2000 and Russell 3000 indexes likely cost index fund investors millions of dollars because of the fact that index funds were likely buying high and selling low, as well as incurring trading costs all along the way. 

One of the risks of investing in index funds is that you get the good with the bad. Index funds simply buy stocks that meet their rules, some of which will perform well, and some of which will ultimately find themselves in bankruptcy court. But the fact that a stock got into an index when it shouldn't have is a risk that, as far as I know, hasn't been an issue before now.

If you've ever wondered why an index fund might own only 2,000 stocks when the index it tracks includes 2,100 stocks, this LongFin debacle goes a long way to explain why. Bad things happen when big funds pile into small stocks, whether on purpose or by an unfortunate accident.