It seems there's a neighborhood pharmacy on every street corner of the neighborhood. An investor could get dizzied when deciding which modernized convenience store chain, if any, to include in their portfolio. 

This warrants a closer look at both Walgreens Boots Alliance (NASDAQ:WBA) and Rite Aid (NYSE:RAD).CVS Health, another competitor in the retail pharmacy space, is combining with Aetna in a $69 billion merger.  

Pharmacist handing a man his medicine

Image Source: Getty Images

Put together, Walgreens and Rite Aid have so much market share  that the Federal Trade Commission thwarted their attempted merger announced in 2015. After regulators derailed the deal by citing antitrust concerns during initial talks, Rite Aid pared down by selling nearly half its stores to Walgreens, leaving it to do business with  2,337 locations. Rite Aid continued seeking another buyer and a failed Albertsons deal followed. The market has punished Rite Aid's stock for the botched deals and weak competitive position, but if the bad news is priced in, then Rite Aid could be a better value than its bigger competitor Walgreens. 

While the store transfer allowed Rite Aid enough cash to retire some large debts, it also bolstered the competitive advantage enjoyed by Walgreens, which will close 600 stores in places where remaining Rite Aid stores are nearby. Any reduced competition from closing those stores won't do leaps and bounds for Rite Aid, but will instead accrue to Walgreens, which raised its estimate of annual cost savings from synergies and store optimization to $650 million in its recent conference call. 

The improved efficiency will be an advantage for Walgreens as it faces increased competition from retailers Walmart and Amazon, the latter of which paid $1 billion for medicine delivery start-up PillPack this past summer. 

Stock performance and valuation

The stocks of Walgreens and Rite Aid began moving in opposite directions when their planned merger started to unravel in early 2017. 

3-year chart of WBA and RAD stock prices.

WBA and RAD stock price data by YCharts.

It's no wonder the market has punished Rite Aid shares. Walgreens' offer to buy Rite Aid for $9.00 per share in 2015 was a 48% premium to its market price then. Following the collapse of the Walgreens deal and the Albertsons deal, Rite Aid's stock has been battered to $1.10 today. 

Walgreens' stock hasn't done well in the last three years, either, but during this time it has steadily increased earnings. Adjusted earnings per share in the fiscal year that ended three years ago were $3.88, compared with $6.02 earned in fiscal year 2018, which ended in August. At today's price, the stock sells at 13 times trailing earnings, below the market multiple, but perhaps a reasonable valuation in light of the market's expectation of anemic 8.5% earnings growth next year.

Rite Aid's valuation is more difficult to assess, given that it's not operating at a profit, due to a shrinking gross profit margin and hefty interest payments. Last quarter, the company reported an adjusted loss from continuing operations of $0.01, and expects fiscal 2019 EPS to be between a loss of $0.03 and profit of $0.01. As a multiple of sales, the stock looks cheap. The company expects revenue in fiscal 2019 to come to between $21.7 billion and $22.1 billion, but the entire company is valued at $1.16 billion for a price-to-sales ratio of 0.05, less than a 10th of what the market is willing to pay for Walgreen's sales. The stock is cheap for a reason.

What really keeps the share price for Rite Aid down is the terrible shape its balance sheet is in, even after paying down some of the debt using cash from its deal with Walgreens. The tangible book value of the company is less than zero, and it has long-term debt of $3.5 billion and negative operating cash flow of about $300 million in the latest quarter. The market is not willing to pay much for Rite Aid's sales because investors are not confident in the company's ability to continue operating without filing for bankruptcy.

Dividends and capital allocation

Walgreens is doing an excellent job of returning capital to shareholders. After raising the dividend 10% last month, it's paying a yield of 2.2%, and has raised its dividend every year since the turn of the century. The company has strong cash flow which has enabled it to aggressively buy back its stock, repurchasing $5.2 billion in shares during fiscal year 2018. Walgreens intends to use $3 billion for stock buybacks in 2019, which brings shareholder return to 6.1% when combined with the dividend.

You can forget about a dividend from Rite Aid, it hasn't paid one since Clinton was in office. Rite Aid needs every cent of cash it generates purely for survival.  

Growth prospects and risks

Both companies are operating in one of the most competitive niches in healthcare, but one company is generating profitable growth and the other is just trying to stay afloat. However, Rite Aid has shown signs of stabilizing its top line, the first step toward strong financial standing.  Revenue in the most recent quarter inched up from $5.3 billion to $5.4 billion, thanks to a 1% rise in same-store sales by its retail pharmacy segment and a 1.1% increase in the number of prescriptions offset a 0.1% dip in front-end sales.

From a profit perspective, the company faces a headwind of lower reimbursement rates from insurance providers. Rite Aid's one hope for digging itself out of the hole is to grow the number of prescriptions it fills by expanding access to more preferred Medicare Part D networks and growing its in-store clinical capabilities, which the company said in a conference call that it plans to do. 

Walgreens was already generating growth before buying half of Rite Aid's stores, but the new locations have already given it a big boost. Sales in the latest quarter grew 10.9% to $33.4 billion, operating income soared 35.6% to $1.5 billion, and adjusted EPS increased 13% to $1.48. Prescriptions filled jumped by 11.8% and  organic sales last quarter were up 3.2%. Looking forward, Walgreens expects 7% to 12% growth in EPS next year, with 5.5% of that growth from share repurchases. 

The two companies are dealing with the risks of falling drug prices and pressure on reimbursement rates, so both are competing to grow the number of prescriptions they fill. Meanwhile, all retail pharmacies are facing new threats from all sides, posed by retail giants Walmart and Amazon entering the prescription drug retail market and by existing specialty pharmacies that already deliver medications.

One solid performer and one with an uncertain future

Rite Aid stock could be suitable for investors willing to take a big risk for a big payoff. It is by no means clear that the company can improve its outlook in its dismal situation. The increasingly crowded pharmacy space coupled with Rite Aid's precarious financial state could be enough to initiate a downward spiral. Rite Aid's competitive edge has been dulled when it sold half its stores to Walgreens. On the flip side, if the company manages to stop the bleeding and take bankruptcy off the table, the stock could make a huge gain.

Walgreens emerges from this comparison as the stronger player and the smart retail pharmacy play for most investors. The Rite Aid deal was a big win for Walgreens, and once the new stores are fully integrated, its core business should be able to generate top-line growth in low- to mid-single digits. There's enough uncertainty about Walgreens' ability to grow its business in a very competitive business environment to make me unenthusiastic about the stock for the long term, but it's the better pick of the two.

Jim Crumly has no position in any of the stocks mentioned. The Motley Fool recommends CVS Health. The Motley Fool has a disclosure policy.