Warren Buffett has said that he'd rather buy a great business at a fair price than a fair business at a great price. This makes sense, since a great business with sustainable competitive advantages held for the long term can return predictable, above-average returns for years, while a fair business might return to fair value but is unlikely to earn extraordinary returns after it does so. The real challenge is finding a great company at a fair price.

Consequently, it's often necessary to wait until news comes along that's negative enough to hurt the stock price temporarily, but not so bad that the company's overall competitive advantage is at risk. Consider the burger wars back in 2003. McDonald's (NYSE:MCD), Burger King's, and Wendy's (NYSE:WEN) margins were hit, but even at the time, it seemed clear that fast food was not dead. McDonald's still had several major competitive advantages that made it much more likely to prosper than collapse. And the double in McDonald's stock price has rewarded investors who recognized that.

So what stock is in that position now? H&R Block (NYSE:HRB) is getting there.

Benefits of ubiquity
If you're an American who files taxes, the odds are better than 1 in 7 that H&R Block prepares your tax return. It has 12,000 locations worldwide and continues to open new locations, most recently in Wal-Mart (NYSE:WMT) stores. When you think of taxes, H&R Block is likely the second name you think of, right behind the IRS. But for now, you can't buy shares in the IRS. H&R Block is so well-known that it's even a now-famous Jeopardy! question.

This ubiquity is a major competitive advantage. People hire accountants to prepare their taxes for convenience and to ensure that the taxes are done correctly so that they receive the full refund. H&R Block's numerous locations mean that there's a convenient office nearby pretty much everywhere in the United States. The strong brand name inspires trust that H&R Block really knows what it's doing.

Another huge competitive advantage for H&R Block is its yearly contact with its clients and its ability to access their financial information. This information has huge potential for generating new business. For instance, H&R Block can easily determine whether it can save clients money on their mortgages. Or it can suggest ways of investing savings through IRAs. Consequently, H&R Block has a beachhead into almost any consumer financial businesses it should choose to enter. It's great investing in companies with competitive advantages in their niche, but it's even better when those advantages can be leveraged into new niches.

And H&R Block has used those beachheads. In fiscal 2004, half of its revenue came from taxes, but about 30% came from mortgages it had originated and then sold to third parties, 15% from business accounting and consulting services, and 5% from investment services.

Why investors hate it
The sentiment on H&R Block is negative right now because of a number of threats. On the tax front, H&R Block has to contend not only with traditional tax preparers like Jackson Hewitt (NYSE:JTX), but also with tax preparation software like Intuit's (NASDAQ:INTU) TurboTax. H&R Block has its own tax software, TaxCut, but TurboTax is a natural choice for people who already store their financial information in Intuit's popular Quicken software. Even worse, this year Intuit is offering a free online tax filing service, SnapTax.

And even if TaxCut holds its own against Intuit's products, H&R Block's traditional business may find customers moving to the lower-revenue software business. The resulting weakened top line could result in squeezed margins. There is some evidence that a migration is occurring. Last year, H&R Block's software clients and online clients increased by 12.2%, but its total clients served fell slightly, by 0.8%.

These are real threats, but they also should not be overestimated. For many consumers, tax software may not be as convenient as a tax preparer, nor provide the same level of confidence that comes from talking to a person who knows taxes. Plus, H&R Block is nicely positioned as a total solution, combining both software and advice.

A second problem that H&R Block faces is ongoing litigation and regulation regarding refund anticipation loans (RALs). With such a loan, an H&R Block client doesn't have to wait for a refund. Instead, the client receives the bulk of the refund immediately as a short-term loan that is repaid when the government delivers the tax refund. Among the charges surrounding these loans are that disclosures about their nature and about H&R Block's fees are poor, interest rates are unreasonably high, and H&R Block has a conflict of interest, violating its fiduciary duties.

Refund anticipation loans are a major component of H&R Block's business. While they are only 8% of revenue, the gross margins on them are almost 55%. Plus, they are important for attracting retail clients. While to me the RAL litigation looks like a money grab by class-action lawyers, it's very difficult to predict the results of litigation or regulation. But the strong demand for these loans gives me some confidence that H&R Block will be able to create a product that both addresses the concerns and serves the market.

Another major concern right now is how H&R Block's mortgage business responds in the face of rising interest rates. This can affect H&R Block in several ways. First, it may reduce the volume of loans that the company originates, affecting the top line. Second, increased competition for the remaining loans may squeeze operating margins. Third, H&R Block originates mortgages and then sells them, often in a securitized form. When it securitizes loans, it bundles up hundreds of loans into a single security, which pays interest based on the cash flows from the mortgages. It sells the securitized loans to third parties but keeps a residual interest and assumes the first risk of loss, should credit losses occur. So, if increasing interest rates cause widespread mortgage defaults, it could hit H&R Block's balance sheet.

Overall, the interest-rate risks do not worry me much. H&R Block has competitive advantages in this area, and the impact of rate increases will be temporary. The risk from the securitized loans seems relatively small, as these assets are less than 7.5% of the total assets on the balance sheet. So these risks are unlikely to hurt H&R Block's long-term competitive advantages.

For the past few quarters, H&R Block has been facing comparable-quarter earnings declines because of the impact from mortgages. In fact, in the most recent quarter, it lowered its earnings-per-share guidance for this fiscal year to $3.50-$4.00. However, this quarter is when H&R Block makes all its money, meaning the quarter will have the most significant impact on full-year results. Last year, the tax business was affected by competition but still delivered record revenues and profits. And with its strong cash flow, H&R Block is both buying back shares -- 6% of the ones outstanding in fiscal 2004 alone -- and increasing its dividend.

In terms of price, H&R Block looks fairly cheap considering its franchise. It has a free cash flow-to-enterprise value ratio of about 15 and a forward price-to-earnings ratio of about 13. Assuming a constant discount rate of 12% and an earnings growth rate of 11% over the next five years -- 2% less than analysts expect -- then 8% for the next five years, and then 4%, H&R Block is worth about $68. So, with a current share price of about $47, it's trading with a comfy 30% margin of safety. Plus, if H&R Block really is a great business, it may continue to achieve extraordinary returns for much longer than 10 years.

H&R Block has major risks, but it still appears to be undervalued. In many respects, it seems similar to a recent Inside Value pick that also is dominant and has huge sustainable competitive advantages in its market but was trading at a EV/FCF multiple of less than 5 because of interest-rate fears. That pick has since risen to an EV/FCF multiple of 6.8. (You can read all about that company by taking a free trial of Inside Value.)

For more thoughts from Foolish Blockheads, check out:

Fool contributor Richard Gibbons is really cheap, likes playing with numbers, and enjoys being a Luddite, so he still files his taxes by hand. He owns shares and call options in H&R Block but none of the other securities mentioned in this report. The Motley Fool is investors writing for investors.