Many people started returning to offices, retailers started opening their doors again last month, and Americans started buying again. Retail sales climbed 17.7% in May from their April lows. Retail sales fell 8.7% in March and another 16.4% in April.

But one area of the market that's grown throughout the coronavirus pandemic is non-store retailers. Retailers that rely mostly on online sales like Amazon (AMZN -0.17%) saw sales climb 3.1% in March and 8.4% in April as physical retailers remained closed. In May, non-store retail grew another 9.8%, despite more physical stores opening.

That's evidence that the effects of the pandemic on shopping habits will be long-lasting, and investors may be able to capitalize on a long-term trend.

Boxes sitting at someone's front door.

A common sight these days. Image source: Getty Images

In-store sales may not bounce back for five years

Earlier this month, eMarketer released a forecast showing how badly the pandemic will hit retail sales. The analysts note, "It will take up to five years for offline sales to return to pre-pandemic levels." Meanwhile, e-commerce sales will continue to climb, supporting a recovery in total retail nearly to last year's levels by next year.

Those numbers represent a massive acceleration in the shift of retail from in-store to online. Retailers that are unable to adapt to online commerce -- more likely, those that haven't already -- will get left behind as more shopping moves online.

Investors shouldn't be looking for the brick-and-mortar retailers successfully navigating their way online, though. A better option is to buy the companies that make it easy to make sales online. These are the companies providing the underlying infrastructure of online commerce.

One of the best companies in that market is PayPal (PYPL 0.10%). PayPal has a competitive advantage versus other payment-processing options since it has already built a massive network of customers. As a result, stores that accept payment via PayPal see lower cart abandonment and greater sales.

While there are other infrastructure providers -- Shopify (SHOP -1.16%) has been a popular pick -- they don't always have a moat. Shopify's source of differentiation stems mostly from its popularity, thus producing lots of tutorials and tools for the platform. But with more small businesses looking to set up online stores, it's seeing greater competition for its basic service coming from many different sources. Meanwhile, its share price has run up to extraordinary highs.

In evaluating which e-commerce infrastructure businesses to buy for the long term, consider their competitive advantage. Even if they're the best option for retailers right now, will they still be the best option in a few years? Moreover, what's the addressable market? PayPal's addressable market is practically any retailer that isn't Amazon. Shopify's platform is practically limited to smaller sellers.

Online retail leaders will only get stronger

Online retail is dominated by Amazon, which commands a near 40% market share. Meanwhile, it's been able to continue expanding that market share thanks to strong network effects, bolstered by its Prime membership service.

Amazon's third-party marketplace accounts for a larger percentage of gross merchandise volume than Amazon itself. Amazon's fulfillment service enables third-party sellers to offer Prime shipping benefits to customers, potentially boosting sales, but it also locks them into Amazon's system with sunk costs of delivering items to Amazon's warehouses. 

The growing number of third-party sellers and products available for Prime shipping creates a virtuous cycle for Prime membership signups and third-party seller services. As more shopping moves online, that virtuous cycle should accelerate, leading to more high-margin revenue for Amazon.

Another online-only retailer worth considering is eBay (EBAY 3.03%). eBay has struggled to grow gross merchandise volume (GMV) on its platform the last few years, but it noted a spike in volume in April and May. It now expects GMV growth between 23% and 26% for the second quarter, which is roughly in line with year-over-year U.S. online retail sales growth in May. That's unlikely to last, as eBay doesn't benefit from the same advantages as Amazon's more capital-intensive strategy.

Still, eBay has a strong network of buyers and sellers, and it's not exposed to lagging brick-and-mortar retail like many other online retail leaders. It should be able to continue growing gross merchandise volume faster than the overall retail industry but will likely continue losing share of e-commerce specifically. It could still be a good option for investors looking to diversify away from Amazon.

There are lots of ways to invest in the shift to online retail, but investors need to consider which companies stand to benefit most in the long run. The numbers suggest that this probably isn't just a temporary spike in sales before returning to normal growth rates.