Charles Dickens wasn't thinking about pharmacy stocks when he wrote the famous words, "It was the best of times, it was the worst of times." Nevertheless, the phrase lends itself well to Rite Aid (NYSE:RAD) these days.

The pharmacy retailer's stock is up more than 20% so far this year. That's definitely a good times story. On the other hand, Rite Aid shares have fallen over 20% in the past three months. With this significant pullback, is now the time to buy Rite Aid?

Source: FoolEditorial on Flickr 

Valuation viewpoints

It would be easy to view Rite Aid as overpriced even with the stock's plunge over the past few months. On a trailing-12 month basis, the company's price-to-earnings ratio of 27 ranks significantly higher than that of larger rivals CVS Caremark and Walgreen, which have P/E multiples of 20 and 22, respectively. If we only looked at the past year, Rite Aid is relatively expensive compared to its peers and to the overall market.

Looking to the future gives a different perspective, however. Thomson Reuters assigns Rite Aid a forward P/E multiple of 13.5. That figure looks attractive stacked up against CVS Caremark's forward P/E of 15.6 and Walgreen's forward multiple of 17.

Of course, CVS Caremark and Walgreen both merit some premium valuation over Rite Aid because of their dividends and larger footprints. CVS' dividend yield currently stands at 1.4%. Walgreen's dividend yield of 1.7% is even more appealing. And consider the scale advantages with size -- Rite Aid had 4,581 drugstores at the end of its most recent quarter, compared to Walgreen's 8,217 and CVS' 7,705. And then there's the issue of historical profitability --  the fiscal year ending in March, 2013, was Rite Aid's first to turn a profit since 2006 (CVS and Walgreen remained profitable for the duration). Even with these disadvantages factored in, though, I think Rite Aid's valuation compares favorably with its peers.

Business > numbers

I wouldn't recommend buying Rite Aid (or any other stock, for that matter) simply because valuation multiples look better than those of other stocks in the industry. That's especially true for forward-based metrics, which usually involve some guesswork from analysts. Instead, look at the business fundamentals that are driving the numbers.

In Rite Aid's case, there are several positives that point to a brighter future. Like CVS Caremark and Walgreen, Rite Aid's profits closely correlate to how much money the company makes from generic drugs -- and McKesson signed an agreement with Rite Aid earlier this year to supply generic drugs, a deal that's expected to save Rite Aid some serious cash. This deal hasn't produced the expected savings yet, but it should begin to help the bottom line within a few months. 

All of the big pharmacy retailers should also benefit from higher numbers of insured Americans. Rite Aid's CEO John Standley noted in June that the company was already experiencing strong prescription growth in states that have expanded Medicaid as a result of the Affordable Care Act. 

Perhaps the most encouraging growth opportunity for Rite Aid is its remodeling of stores with its Wellness model. These Wellness stores will help the company to offer more healthcare services, including medical clinics and the Health Alliance program for patients with chronic conditions. As of June, around 29% of Rite Aid's stores had been remodeled. These stores boast higher front-end sales and prescriptions filled than the company's other stores. So as more stores are remodeled, this should boost Rite Aid's financial results.

Right time for Rite Aid

I like the long-term prospects for Rite Aid. The fundamentals are in place for solid performance over the years to come. My hunch is that the projected growth numbers for the company aren't too far off, and that Rite Aid's shares have plenty of room to run.

That's not to say that the stock can't go lower. It could. An overall market correction or disappointing earnings could take a toll. Given a long enough horizon, however, Rite Aid should do well. Given Rite Aid's opportunities, the pullback might be an opportunity to get a great company at a great price.