Truth be told, there are a lot of ways to lose money in the stock market. Buying penny stocks, chasing the latest hot trend without understanding the economics behind it, or trying to time the stock market, are examples of easy ways to watch your nest egg shrink.

Then again, sticking to a short list of rules can greatly increase your odds of making money in the stock market. These "rules" include doing your homework and reviewing your investment thesis often to ensure it still holds water, as well as approaching your investments from a long-term perspective. Though the stock market has had its fair share of hiccups throughout history -- the S&P 500 has had 36 corrections of at least 10% since 1950 -- it's still returned an average of 7% per year, inclusive of dividend reinvestment and when adjusted for inflation.

Further, at no point during the S&P 500's history has the index lost money over a rolling 20-year period. While the stock market offers no guarantees, that's a pretty good indication that investing in high-quality businesses over long periods of time generally gives you an above-average opportunity to grow your portfolio.

A miniature businessman attempting to hold up a hundred dollar bill which is being stepped on by a much larger shoe, representing big business.

Image source: Getty Images.

These businesses take competitive advantages to an entirely new level

But there's another trick you can use to give yourself an even better chance to prosper: target companies with impenetrable competitive moats. By "competitive moat" I'm referring to the ability of a business to maintain its competitive advantage(s) over its peers. Companies that are able to secure their competitive advantages for long periods of time should be able to rake in the profits, so to speak, during both bull and bear markets.

While competitive advantages do exist in nearly every industry and sector, the ability to hold onto those advantages over long periods of time is much rarer. However, the following three stocks have what I believe is as close to an impenetrable moat as you're going to find for a publicly traded company.

A surgeon holding a one dollar bill with surgical forceps.

Image source: Getty Images.

Intuitive Surgical

To begin in the healthcare sector, we have robotic-assisted surgical system developer Intuitive Surgical (NASDAQ:ISRG). What makes this company so special is its installed base of machines, as well as what should happen to its operating margins over time.

As of March 31, 2018, Intuitive Surgical had 4,528 da Vinci surgical systems installed in hospitals and universities around the world. You could probably add all of its competitors together and still not even come within a stone's throw of Intuitive Surgical's installed base of machines since the year 2000. 

It's also spent countless hours training surgical staff in these hospitals how to operate its machines, which range in price from $0.5 million to $2.5 million. Rapport like this within the medical community is priceless, meaning Intuitive Surgical likely has its customers locked into using the da Vinci system, and/or subsequent new models of the da Vinci system, for a long time to come.

That leads to the next point: operating margins. You might be under the impression that the prize for Intuitive Surgical is the sale of its expensive operating machines, but that couldn't be further from the truth. These are intricate machines that generally cost a lot to build, and thusly have low margins. The bulk of Intuitive Surgical's margins are derived from the sale of instruments used with each procedure, as well as from servicing on its machines. These high-margin categories should only grow as a percentage of total revenue as the company's installed base on da Vinci systems increases. Translation: margins should improve over time.

With a stranglehold in urology and gynecology surgeries, Intuitive Surgical has plenty of room for market share expansion in colorectal, cardiovascular, and general soft tissue surgical procedures. It looks to have an impenetrable economic moat.

A Sirius XM in-dash radio display inside an automobile.

Image source: Sirius XM Holdings.

Sirius XM Holdings

Another stock that stands head-and-shoulders above its competition is satellite-radio operator Sirius XM Holdings (NASDAQ:SIRI), mainly because there is no direct competition. Yes, Sirius XM faces pressures from online and terrestrial radio, but when it comes to satellite radio, it's the only game in town.

However, being the only satellite radio operator isn't enough alone to make it worth your while. It's two particular aspects of Sirius XM's business model that should allow this company's economic moat to remain impenetrable.

First, let's look at how Sirius XM generates its revenue relative to how online and terrestrial radio operators bring in cash. For the latter, it's predominantly an ad-based business model. This works fantastically when the U.S. economy is bustling and businesses are willing to pay radio operators to reach their listening audience. But when recessions hit – recessions are an inevitable part of the economic cycle – ad spending often falls, putting traditional radio operators in a bind.

Meanwhile, Sirius XM generates nearly all of its revenue from a subscription-based model, with somewhere in the neighborhood of 3% of total revenue derived from ads.  The subscription model isn't as susceptible to recessions, and with minimal reliance on advertisements, Sirius XM is better situated to survive the natural peaks and troughs of the U.S. economy.

And second, Sirius XM benefits from its relatively fixed-cost model. Yes, it does have to spend to hire talent, and celebrities like shock-jock Howard Stern don't come cheaply. But when we're talking about general expenses, Sirius XM's satellite system costs the same regardless of how many subscribers the company has. This suggests that its margins should improve over time as its subscriber base expands. Plus, being the only satellite provider affords Sirius XM exceptional pricing power, should it want to lift its margins even higher.

My suggestion? If you're an investor in Sirius XM, don't touch that dial.

An Amazon logistics employee preparing products for shipping.

Image source: Amazon.

Amazon.com

Finally, I think you'd be a bozo to bet against Bezos! Though the retail sector is rife with competition, the moat that e-commerce and Web-service giant Amazon.com (NASDAQ:AMZN) has built is going to be next to impossible to overcome.

Amazon's (not so) secrets to success are its intricate distribution system and reasonably low overhead. Rather than maintaining a storefront presence, and buying goods with the hope that they won't tie up inventory for months to come, Amazon has angled itself as the go-to source for e-commerce purchases. Amazon can purchase what it needs when the consumer places the order, and through its extensive distribution system satisfy those orders from warehouses that do contain these goods within a relatively short time period. What this ultimately means is the ability to undercut the pricing of pretty much any traditional retailer. Consumers have long demonstrated that price matters, and virtually no company can compete with Amazon when it comes to price.

Amazon also has a moneymaker in its back pocket known as Amazon Web Services, or AWS. It wasn't good enough to simply roll out Prime memberships and secure the loyalty of tens of millions of online shoppers. Amazon has also become a dominant force in providing cloud services for small- and medium-sized businesses. AWS, despite accounting for just over 10% of total sales during the first quarter, generated more than 70% of the company's operating income. As AWS grows -- 30%-plus growth per year for the foreseeable future is possible -- the company's operating margin should expand. 

And this brings me to the final point: Amazon's cash flow is incredible. With Wall Street projecting a compound annual growth rate in cash flow per share of 37% through 2021, Amazon is going to have more cash than ever to throw at disruptive projects.

Though the rule of large numbers would suggest Amazon's stock could struggle from here, its competitive moat would say otherwise.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Sean Williams has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Amazon and Intuitive Surgical. The Motley Fool has a disclosure policy.