Amazon (AMZN -1.35%) did it again.

The tech giant has elbowed its way into yet another industry, launching Amazon Pharmacy, an online pharmacy that offers Prime members free two-day delivery on prescriptions and savings of up to 80% on generics and 40% on brand-name medications, even without insurance. Amazon is also partnering with more than 50,000 pharmacies to make the same savings available.

The news comes more than two years after the company bought online pharmacy Pillpack for $1 billion and signaled its interest in the pharmacy industry, so today's announcement wasn't entirely a surprise. Pillpack, which specializes in managing multiple daily medications for customers who have chronic conditions and want pre-sorted dose packaging, will now be contained within Amazon Pharmacy. 

Not surprisingly, pharmacy stocks, including CVS (CVS 0.47%)Walgreen Boots Alliance (WBA -1.12%), Rite Aid (RAD -27.27%), and GoodRx (GDRX -4.10%), tumbled on the news, with all four losing 8% or more. In fact, the stocks fell by a similar amount when the Pillpack acquisition was first announced.

Three bottles of pills from Amazon Pharmacy

Image source: Amazon.

Amazon, of course, has a reputation for disrupting industries, as it has shown time and again it's willing to sacrifice profits for market share gains, often instigating price wars. Additionally, with more than 150 million Prime members, Amazon has significant competitive advantages in retail, and millions of those Prime members will likely be interested in taking care of new benefits. Still, Amazon's takeover of the pharmacy industry is far from a foregone conclusion.

A trip back in time

Amazon's biggest acquisition to date was its 2017 purchase of Whole Foods Market for $13.7 billion. The news shocked the market, and supermarket stocks like Walmart (WMT -0.35%)Costco (COST -1.78%)Kroger (KR 0.29%), and Target (TGT -0.67%) all sold off sharply when the announcement was made. Investors clearly thought that Amazon's entry into groceries through its acquisition of a high-profile chain like Whole Foods would weigh on future growth for those competitors. But that hasn't been the case.

Since that announcement, all four of these stocks have outperformed the S&P 500 by a wide margin, with the exception of Kroger.

WMT Chart

WMT data by YCharts

Groceries aren't the only factor in these stocks' outperformance, but what's notable about their returns since the Amazon-Whole Foods deal is that management for each company has responded aggressively to Amazon's incursion in the supermarket industry. Walmart, which was already expanding its grocery pickup stations, has ramped up those efforts and now offers grocery pickup at 3,600 stores and same-day delivery from 2,900.

Soon after the deal, Costco launched its own e-commerce program, partnering with Instacart to provide same-day delivery on perishables, and offering free two-day delivery on non-perishables with a $75 order minimum.

Target acquired delivery specialist Shipt later that year and has ramped up its own store-based same-day fulfillment services like Drive Up and Order Pickup. Finally, Kroger bought online grocery company Ocado to help with its digital fulfillment.

These companies have seen their e-commerce sales surge during the pandemic, and by embracing e-commerce, it seems that these companies have become Amazon faster than Amazon has become them, defending themselves from Amazon's disruptive force. Additionally, Amazon's acquisition of Whole Foods doesn't seem to have worked out quite as it hoped. Amazon is now opening its own supermarket, Amazon Fresh, and Whole Foods stores have experienced traffic declines in recent months, even as other grocers have seen rebounds.

Amazon still has just a sliver of market share in groceries, well behind Walmart, Kroger, and Costco.

What it means for pharmacy stocks

The pharmacy industry isn't the same as groceries, and Amazon may have some natural advantages here. It's much easier to ship prescription drugs than perishable foods, for example, and drug prices are more difficult to compare than, say, a gallon of milk.

But pharmacy chains like CVS and Walgreens have their own advantages, including urgent care centers that are rapidly expanding, and retail partnerships, like CVS with Target, and Walgreens with Kroger. Those create natural alliances that can help the drugstore companies fend off Amazon, and help them facilitate online ordering and delivery.

If there's one clear lesson from the grocery sector, it's that these companies will respond to Amazon's entry -- likely with their own investments in e-commerce, possibly including an acquisition, and improvements to streamline customer service. Chains like CVS, Walgreens, and Rite Aid have thousands of stores near their customers, potentially giving them an advantage.

It's also worth remembering that Amazon's progress in healthcare has been relatively slow. It took nearly two and a half years for the company to move from the Pillpack acquisition to the launch of Amazon Pharmacy, which, though it's a big step, makes the pharmacy sell-off after Pillpack look silly. Similarly, its Haven joint venture with Berkshire Hathaway and JPMorgan Chase has yet to have the disruptive effect that some envisioned.

In other words, the pharmacy chains will have time to respond. If they can make the same advances that their grocery counterparts did in e-commerce, they should be able to neutralize the threat from Amazon.