Online retailers enjoy a structural advantage compared to traditional retailers -- they don't have the burden of a large store base to maintain. Having too many stores in an environment where sales are shifting online has been the main driver behind the surge in retail bankruptcies over the past few years. Many surviving retailers are closing stores in an effort to adjust.

But online retail comes with its own set of costs. Shipping is the obvious one. It's more expensive to ship small numbers of items to customers than it is to ship truckloads of items to stores. Overwhelmingly dominant e-commerce specialist Amazon.com (NASDAQ:AMZN) spent a whopping $7.2 billion on shipping in 2016, net of shipping-related revenue like Amazon Prime membership fees.

There's another cost that drives down Amazon's margins: advertising. Amazon spent $7.2 billion on marketing in 2016, with that spending aimed at driving customers to its websites. Amazon's marketing spending rose 38% in 2016, while total revenue grew 27% and product sales grew 19%.

An Amazon fulfillment center.

An Amazon fulfillment center. Image source: Amazon.

How does that compare to other retailers? Amazon spent more on marketing last year than Wal-Mart Stores (NYSE:WMT), Target, Best Buy (NYSE:BBY), Home Depot, and Kroger  combined. Those retailers collectively produced $800 billion of sales, six times Amazon's total sales. Even for Amazon, with tens of millions of Prime members and a staggering e-commerce lead, getting customers to click "buy" isn't cheap.

One of these is not like the others

One thing to note: These five retailers report advertising spending, while Amazon reports marketing spending. Marketing is a broader term that encompasses more than just direct spending on ads, so this comparison isn't quite apples-to-apples. However, Amazon states in its 10-K that its marketing costs are largely variable, and that the increase last year was due primarily to increased spending on online and television ads. This suggests that advertising costs account for the bulk of Amazon's marketing spending.

Here's a chart showing how much revenue each of these retailers produced last year: 

2016 revenue for Amazon, Wal-Mart, Kroger, Home Depot, Target, and Best Buy.

Data from annual reports. Chart by author.

And here's how much each spent on advertising (or marketing, in Amazon's case):

Chart showing advertising spending for Wal-Mart, Target, Home Depot, Best Buy, and Kroger, and marketing spending for Amazon.

Amazon figure is marketing spending. Data from annual reports. Chart by author.

As a percentage of revenue, Amazon spends dramatically more on marketing than any of these other retailers spend on advertising:

Chart showing advertising spending as a percentage of revenue for Amazon, Wal-Mart, Target, Home Depot. Best Buy, and Kroger.

Data from annual reports. Chart by author.

Some brick-and-mortar retailers, particularly department stores, spend an Amazon-like percentage of revenue on advertising. Macy's, for example, spent 4.5% of revenue on advertising last year. But discount retailers like Wal-Mart are able to keep prices low in part because they spend so little on advertising relative to sales. Notably, warehouse club Costco spends nothing on advertising, other than sending coupon books to members and pre-opening mailers to prospective members.

Of course, Amazon is growing much faster than these other retailers, and the heavy marketing spending is helping to drive that growth. But high advertising costs seem to be a common denominator when it comes to online retail. Wayfair, an online furniture seller, spent a whopping 12.1% of revenue of advertising in 2016, and its long-term goal is to bring that number down to a range of 6% to 8%.

Competition is heating up

One reason to believe that Amazon will need to continue spending heavily on marketing is the newfound focus of traditional retailers on e-commerce. Wal-Mart has become extremely aggressive, launching a free two-day shipping initiative earlier this year and finding ways to remove costs and lower prices for customers. Wal-Mart's online sales grew by 63% year over year during the first quarter, twice its growth rate during the previous quarter.

Best Buy has also turned up the heat over the past few years. The company implemented a price-matching policy both in-store and online, and it started shipping some online orders from its more than 1,000 stores. This not only improved the availability of items online, but it reduced shipping times as well. Best Buy turned its store base, viewed as a liability in the age of e-commerce, into an asset. These initiatives helped drive online sales growth in excess of 20% in the first quarter.

But for the same reason that Amazon needs to spend so heavily on marketing to drive sales, traditional retailers going after online sales will likely need to do the same in order to drive customers to their own websites. I wouldn't be surprised to see advertising costs as a percentage of revenue creep up in the coming years for retailers like Wal-Mart and Best Buy as they grow their online businesses. That could, in turn, drive up advertising rates for Amazon and lead to even higher spending.

Amazon spends a lot of money driving customers to its website. It would likely need to spend even more if its Prime subscription service weren't so popular. The most successful brick-and-mortar retailers are far more efficient, creating greater revenue for each dollar of advertising. Whether they can maintain that efficiency as sales continue to shift online remains to be seen.

Timothy Green owns shares of Best Buy. The Motley Fool owns shares of and recommends Amazon, Costco Wholesale, and Wayfair. The Motley Fool recommends HD. The Motley Fool has a disclosure policy.