Costco (COST -0.12%) and Amazon.com (AMZN -1.65%) both compete for value-conscious customers while sharing a lot of the same user base.

In fact, a recent study from Morgan Stanley, as reported in The Seattle Times, found that "Costco and Amazon can coexist." The company surveyed 2,700 people and found that 45% of Costco members also had an Amazon Prime membership.

"Members of both Costco and Prime have not and generally do not intend to spend more with one retailer/e-tailer at the expense of the other," according to the report, which noted brand loyalty as being a boon to both.

That said, while Amazon hasn't hurt Costco as it has so many other retailers, its very existence may have dimmed its growth possibilities. The warehouse club isn't losing customers -- it inched up its membership base, its revenue, and same-store sales globally in its fiscal 2017, but its increases are steady, not spectacular. Amazon, on the other hand, has relatively large swings in profit or loss, but its overall growth has been much larger.

In some ways, whether you consider Costco or Amazon a better stock depends on your tolerance for instability. The online retailer has sent its shares to bigger gains, but it also experiences big dips when a quarter comes in poorly. Costco, on the other hand, is methodical, moving ever upward, but seemingly in no race to get anywhere:

Image source: YCharts.com.

The case for Amazon

Amazon doesn't always make money, but its sales growth has been incredible. The digital retailer posted year-over-year sales growth of 28% in Q1, 31% in Q2, and 29% in Q3. However, despite those big increases -- because the company invests so heavily in future growth while keeping margins low -- it doesn't always make all that much money.

In Q3, net income was $252 million, or $0.52 per diluted share, up from $79 million in the same period a year ago. Investors didn't cheer that number, because it was well down from Q2, when the company had net income of $857 million. Similarly, investors were happy in Q1 when the company turned a 2015 loss of $57 million ($0.12 per diluted share) into a gain of $513 million ($1.07 per diluted share).

Amazon is a bit of a wild ride, and the company spends money on wide-ranging products that don't always pay off. Still, the company has more Kindles, Echos, Amazon Web Services, and other successes than it does failures such as the Fire Phone.

The case for Costco

Costco doesn't appear to spend much money on anything other than building new locations. The company has a model that works, and for decades it has ridden that model while only tweaking its formula. Some would say that focus will ultimately hurt the chain, as it hasn't developed an online model.

Still, while Costco doesn't put up Amazon-like growth, it does grow steadily. In its now-completed fiscal 2016, when you factor out the impact of lower gas prices, it put up 3% same-store-sales growth in the United States and 4% growth globally. That's pretty similar to the 2% U.S. gain and 3% overall growth in Q4, and not all that different from the 1% U.S. and 2% global growth it posted in Q1 2017.

The warehouse club, of course, does make only about 25% of its money from actually selling stuff. Its real profits come from memberships. Those numbers inched up globally in fiscal 2016, with the company's switch of corporate credit cards in June acting as a one-time drag.

In Q1 2017, the company reported a 6% increase in membership fees -- partly because of increased prices in some global markets and partly because of new signups. At the end of the period, household memberships climbed to 47.9 million, up from 47.6 million at the end of the previous year.

Costco showed net income of $2.35 billion for fiscal 2016 ($5.33 per diluted shares), down slightly from $2.38 billion the previous year. In Q1 2017 net incomes was $545 million ($1.24 per diluted share,) compared with $480 million, or $1.09 per diluted share, in 2016. Basically, Q1 2017 equals about 25% of the net income the company showed for the previous year.

Which is the better buy?

Aside from the wild card of what the internet could ultimately do to Costco -- something it has so far been immune to -- it offers very predictable returns. For investors who check numbers, read reports, and look at stock prices regularly, it's easy to see why that might be comforting.

Amazon, however, has a higher ceiling. The company dominates online retail, and it has become a top player in the growing cloud services market with AWS. It may have a similar hit in home automation and digital assistants with Echo, and it produces enough cash to fund an occasional flop, which gives it chances to have even more hits.

Amazon will have more bad quarters than Costco, but for a long-term investor it's a better buy. Costco does retail well, but Amazon has successfully moved beyond that. Sometimes it's a company that causes shareholders to hold their breath a bit, but in the long run Amazon has a stable sales base into two areas -- retail and AWS -- as well as tremendous upside in those and other markets.