Yeah, you heard that right. Regulation is great! It's not what everyone likes to hear. After all, regulation often creates inefficiencies in the economy and makes it difficult and expensive for businesses to grow. Even the most unregulated businesses need to build up bureaucracies to deal with red tape.

But I'm not an economist. I'm an investor. And governments meddling in corporate affairs can occasionally be wonderful for investors -- even when it's negative for consumers or the overall economy.

Building a wall
Regulation can be excellent at creating artificial barriers protecting the position of leading businesses. In some cases, the barrier is deliberate. Patent regulations, for example, give Pfizer (NYSE:PFE) a temporary monopoly on Viagra. Since nobody else can manufacture Viagra until the patent expires, Pfizer can charge high prices without worrying about someone selling a cheaper generic version. The system is set up this way to encourage companies to invest in research. If businesses can't obtain a reasonable return on their investment, they're unlikely to spend money on research.

But even beyond patents, regulations form a major barrier against small companies in the pharmaceutical business. Getting a drug approved for sale is a complicated, expensive, and bureaucratic process. Huge companies such as Pfizer, Johnson & Johnson (NYSE:JNJ), and Merck (NYSE:MRK) have both the resources and the corporate knowledge to navigate the regulatory process. Many smaller companies do not. Thus, even if a small company has a promising drug, it may need to partner with one of the top drug companies simply to jump the regulatory hurdles. In other words, the barriers caused by regulations give a major edge to large pharmaceuticals and make them particularly attractive investments.

Similarly, when the government tries to regulate low prices, it can actually have the effect of reducing competition. Large companies frequently have economies of scale allowing them to provide their services at prices that smaller companies can't match. Thus, if a law forces companies to reduce the price they charge, small businesses may become unprofitable and have to consolidate with bigger companies or go into bankruptcy. This has happened with health service plan providers. As governments seek to reduce health care costs, these companies become a natural target for regulation. To respond to that regulation, Aetna (NYSE:AET) and WellPoint (NYSE:WLP) have gone through many acquisitions to achieve the lower costs provided by economies of scale. So over the long term, this sort of regulation can sometimes be good for investors in large companies, since it limits competition.

Profit from panic
Investors can also profit from regulation by exploiting the opportunities that arise when the market panics in response to new laws. For instance, the U.S. House of Representatives recently passed a bill banning certain types of Internet gambling. And while the bill hasn't passed the Senate yet, and it may not, fears about regulation have hit many online gaming stocks, including CryptoLogic (NASDAQ:CRYP), hard.

As a result, some companies possessing both huge growth rates and networking effects -- arguably the strongest competitive advantage a business can have -- are trading relatively cheaply. I've taken advantage of the volatility by picking up shares of CryptoLogic and PartyGaming.

Buying the strongest businesses during a panic over new laws can be lucrative. The Balanced Budget Act of 1997 cut Medicare payments to nursing homes and triggered a wave of bankruptcies in the sector. It was a major crisis, but it did seem clear that at least some nursing home businesses would come out the other side. One way or another, someone would still need to care for the elderly. Investors who focused on the companies in the sector with the greatest financial strength made decent profits. Manor Care (NYSE:HCR), for example, is now trading seven times higher than it was in the dark years after the act passed.

The Foolish bottom line
There are many cases where regulation is downright frustrating. But regulation also brings opportunities. If you can determine when regulation acts as a barrier to entry, you can find companies that are almost impossible for competitors to displace. Or by buying cheaply when regulatory fears are high, you can potentially reap significant profits when the cloud passes. This is what we do every day at Inside Value -- take advantage of market sentiment to buy great companies at cheap prices. If you use a similar strategy or are interested in learning more, I invite you to check out our top picks using this free pass.

Fool contributor Richard Gibbons has many bureaucratic ambitions. He owns shares of CryptoLogic and PartyGaming but does not have a position in any of the other securities discussed in this article. Pfizer is an Inside Value recommendation. CryptoLogic is a Hidden Gems pick. Johnson & Johnson is an Income Investor recommendation. The Fool's disclosure policy is a regulation we have to live with.