Retail has been a difficult sector, with consumers increasingly shifting toward internet shopping. But the so-called "retail apocalypse" has likely been overhyped, and there could be some big opportunities for intrepid investors -- which brings us to pharmacy giant Walgreens Boots Alliance (WBA -1.33%) and retail-focused real estate investment trust (REIT) Realty Income (O 0.52%). One is a direct play that recently announced plans to close hundreds of stores, and the other counts Walgreens as its single largest tenant. Which, if either, is the better buy?

The tenant

Walgreens owns and operates pharmacies, and runs a wholesale business that sells prescription drugs to other pharmacies and hospitals. Its portfolio of owned and operated pharmacies spans more than 11 countries, and its operations touch 25 countries in total. Simply put, it has a very broad reach.

A man holding his head with a candlestick chart heading lower behind him

Image source: Getty Images

The company, however, recently announced plans to shutter 200 U.S. stores. Now add in the fact that Amazon has been trying to get into the pharmacy business, using the acquisition of Pillpack to build an online pharmacy operation. As more and more retail sectors once thought immune to online shopping prove susceptible to the retail apocalypse, it's no wonder that investors are worried about Walgreens. And that's on top of existing concerns surrounding reimbursement rates, increased prescription sizes (which reduce the number of times a customer has to visit a store), and the uncertainty about the future structure of the U.S. healthcare system. Shares are down roughly 25% so far this year.

However, there's more to this story. The 200 stores represent just 2% or so of the company's over 9,500 U.S. locations. That's a tiny slice, and it looks more like the company is repositioning around its best assets. In fact, in some areas there are a lot of stores in close proximity to each other, so there's a good chance the company doesn't lose much pharmacy business from this move over the long term.

And then there are the financial numbers. Walgreens has increased its sales in nine of the last 10 years. Over that time span, earnings have increased from roughly $2 a share in 2009 to around $5 a share in 2018. Its dividend has been increased every year for 44 consecutive years, with the current payout ratio a reasonable 35% or so. The debt to equity ratio, meanwhile, is a solid 50%, and interest coverage is a robust 7.9 times, showing there's little reason to worry about the balance sheet. Not only does the company appear to be holding up pretty well, there doesn't seem to be much risk of a dividend cut.

Even if you dig into recent results a little deeper, the risks don't appear to be too material. For example, the company's U.S. pharmacy sales rose 7.7% year over year through the first nine months of fiscal 2019. Strength on the drug side of the business offset mixed results on the retail side (all the stuff in the front of the store that isn't sold via prescription). But even the retail business wasn't a disaster, with total sales up 1.3% and comparable store sales down 2.7% over the nine-month span. "Mixed" is probably the best way to describe that. The international business was less positive, with sales down 2.1%, but the wholesale operation was a strong performer, with sales up 8%. All in all, the company is managing pretty well.

Investors clearly don't care, though, and appear to be predicting bad times, reading the rather small number of store closures as a sign that the internet is going to eat Walgreens' lunch. That's compounded by the company's weak bottom-line results, as the investments it is making to adjust to changing market conditions (including cost cutting, creating partnerships with suppliers, and testing new retail concepts with a large grocery chain) have created cost headwinds and won't provide an uplift until some point in the future.

The landlord

Realty Income is a bellwether REIT focused on net lease properties. That means it owns the asset, but the lessee is responsible for most of the operating costs. It's a fairly low-risk investment approach, with Realty Income basically collecting the difference between its financing costs and the rent it charges. 

WBA Chart

WBA data by YCharts

That said, Walgreens makes up roughly 5.8% of the rent roll, and is Realty Income's single largest tenant. Competitor CVS pitches in another 1.7%, bringing the company's total pharmacy exposure to nearly 8%. If the pharmacy sector is going to take its turn in the internet's sights, Realty Income has some very notable exposure.

But the company isn't likely to see all of its drug store properties vacated, even in a worst-case scenario. And it has plenty of other properties (it owns around 6,000 buildings in total), spread across a number of retail sectors (retail is 82.5% of total rents), industrial properties (12%), and offices (4%) to fall back on. And, like Walgreens, Realty Income has done a stellar job of executing over time, with solid adjusted funds from operations (AFFO) growth and consistently high occupancy levels. Add in a dividend that has been increased every year for 26 consecutive years and the story starts to look pretty good.

Why bother with a retailer like Walgreens that's facing increasing competition on the web in an increasingly difficult niche when you get more diversification from Realty Income? And the two stocks have roughly similar yields, with both Realty Income and Walgreens offering up around 3.6%. 

The fly in the ointment

The problem here is that Realty Income is up 17% so far in 2019. That 3.6% yield? Well, it's near the lowest levels in the REIT's history. And based on the company's AFFO estimates for 2019, it is trading at a price to AFFO multiple of around 22 times. That's a multiple you would expect from a growth company, not one that has an average AFFO growth rate of around 5% and a history of increasing its dividend in the low- to mid-single digits range.

WBA Dividend Yield (TTM) Chart

WBA Dividend Yield (TTM) data by YCharts

By comparison, Walgreens stock, which is down materially this year, is offering a yield toward the high end of its historical range. It looks cheap today, a fact backed up by its price to sales, price to earnings, price to cash flow, and price to book value ratios, which are all sitting below their five-year averages, often significantly so. This despite the fact that Walgreens has a long history of success, has been doing reasonably well overall, and is implementing plans to deal with changing market conditions. Yes, things are tough right now, but financially strong Walgreens looks capable of supporting its business and rewarding investors while it adjusts its business to deal with the headwinds it's facing.

It would be silly to suggest that owning Walgreens comes with no risk -- the internet is a very real threat, as are the other issues the company is dealing with. Risk-averse investors should probably not step in here. However, for those with a little more tolerance for uncertainty, the current price looks attractive.

Realty Income, on the other hand, looks like it is priced for perfection. It's a great company, but perfection is impossible. With the price down so much, Walgreens looks like the better option today.