(AMZN 0.73%) is the kind of stock that makes investor scratch their heads. It's valued at over $230 billion, yet it has hardly any profits. It's widely believed to have a sustainable competitive advantage in a number of areas, but that doesn't amount to anything on the bottom line.

As a result, the market has struggled to value the company since its inception more than 20 years ago. Valuing a profitless company is difficult enough, but Amazon also straddles the retail and tech industries, adding a further layer of confusion. There is no peer company to compare it to.

Analysts often take Amazon to task for its lack of profits, but investors have been rewarded several times over as the stock is now more valuable than Wal-Mart Stores (WMT 0.89%) and all but a handful of American companies.

Oddly, Amazon's ability to create market value without making a significant profit is arguably a strength of the company's, and separates it from competitors like Wal-Mart, which are bound by shareholder expectations to generate and distribute earnings. 

Founder Jeff Bezos has told investors all along that he is building it for the long term, delaying profits to create a sustainable competitive advantage. Investors have thus far bought in, giving Amazon the room to invest in new projects and grow them over time without the need to satisfy quarterly earnings estimates.

Freedom to experiment
Amazon is known for being unafraid to take risks and fail. It's had its share of flops, including the Fire phone, but the ability to invest in new ideas and let them grow over time has given birth to segments that are now core components of its business. The company spent more than two years developing its cloud computing unit, Amazon Web Services, before launching it. It originally just served as a way for Amazon to handle its own storage needs before being opened to third-party clients. Today, it's a multi-billion-dollar business.

Other concepts, like Prime and Amazon Marketplace are now thriving, in part because they were given time and money to grow.

Wal-Mart, on the other hand, finds itself playing catch-up in e-commerce and other areas. The retail giant has allocated $1.1 billion to its e-commerce platform for the current year, but that pales in comparison to the nearly $10 billion it spent on dividends and share buybacks over the last four quarters.

Wal-Mart was also punished by Wall Street when it said that recent wage hikes would cut into profit this year. While the company sees those investments as necessary, the market expects it to deliver steady earnings growth each year.

Stock-based compensation
At the same time that retailers like Wal-Mart are buying back shares to buttress their stock prices and boost earnings per share, Amazon is still diluting its stock. In 2015, the company spent more than $2 billion on stock-based compensation, saving itself valuable cash resources. The company can do this because its investors allow it to, and because the stock's history of appreciation makes it a valuable compensation tool for employees.

Potential Amazon employees are much more likely to be motivated by stock-based compensation than their counterparts at Wal-Mart. Over the last three years, Amazon has saved more than $4.5 billion in cash through stock-based compensation, diluting shares outstanding by about 1.5% each year. Amazon's investors accept that as part of the company's strategy, and give it room to do so. Wal-Mart, meanwhile, has spent $17.5 billion on buybacks over the last three years, and recently authorized $20 billion more for buybacks.

Cash flow > profits
While Amazon's profits continue to hover near the breakeven mark, the company is profitable on a free-cash-flow basis, with $7.3 billion in free cash flow in 2015. While critics say that figure is inflated due to capital leases, even excluding these leaves $2.5 billion in free cash flow. Because of depreciation, fast growth, and its ability to score desirable credit terms, Amazon's cash position is stronger than its income statement would indicate.

Amazon now appears poised to take on logistics and shipping services. Like AWS and its other projects in the past, these investments will eat into profits in the near-term -- but Amazon has shown time and again that it's unafraid to play the long game. If successful, building out a logistics service will only enhance the company's competitive advantages and add market value down the road, despite the cost to the bottom line.