Amazon is buying online pharmacy PillPack — a move that could disrupt the drug store business.

PillPack has pharmacy licenses in all 50 states. The company delivers medications to customers in pre-sorted doses designed to make it easier for people to take multiple medications a day.

Amazon (AMZN) was widely expected to move into the pharmacy business.

And Amazon CEO Jeff Bezos, the world's richest man, is creating a health care company along with JPMorgan Chase (JPM) and Warren Buffett's Berkshire Hathaway (BRKA).

The PillPack deal is already scaring investors in the top two drug store chains.

CVS (CVS) fell 9% in early trading. Walgreens Boots Alliance (WBA), the newest Dow component, plunged more than 10%. Walgreens was already trading lower after reporting a drop in same-store sales at its US pharmacies.

Related: Amazon is already trying to disrupt health care

Rite Aid (RAD) shares also fell, as did the stocks of big drug distributors Cardinal Health (CAH) and AmerisourceBergen (ABC).

These and other health care stocks rose a few months ago after reports that Amazon may not have been interested in selling prescription drugs. So much for that.

It's not clear yet just what Amazon plans for PillPack. Will it eventually merge it into a broader health care platform on Amazon or keep it independent as it has done with other subsidiaries like shoe retailer Zappos and video site Twitch?

The fact that PillPack is already licensed to sell prescriptions may persuade Amazon to keep it independent.

But all the companies said on Thursday was the deal was subject to some regulatory approvals and that the companies hope to close the transaction during the second half of this year.

Related: PillPack vs. Express Scripts -- People suffer when business turns ugly

Walgreens doesn't seem too worried.

During the company's earnings call Thursday morning, Walgreens CEO Stefano Pessina said in response to a question about the PillPack deal that the pharmacy business is "much more complex than just delivering certain pills or certain packages."

Pessina added that physical pharmacies "will continue to be very, very important in the future."

The PillPack acquisition comes just a week after CVS announced it will start delivering prescriptions to people's homes — a response to growing competition from PillPack and Capsule, another online pharmacy startup.

Related: Amazon wants you to start a business to deliver its packages

The health care industry is also in the midst of merger mania. CVS is buying insurer Aetna for while Cigna (CI), another insurer, is scooping up pharmacy benefits manager Express Scripts (ESRX). Both deals are valued at nearly $70 billion.

Those deals were announced after two mega insurer mergers were blocked by federal judges early last year on antitrust grounds. Aetna had hoped to combine with rival Humana (HUM) while Cigna was planning to merge with Anthem (ANTM).