Image source: Getty Images.

It has been a tough year to be a Gilead Sciences (GILD 0.07%) shareholder. Fears of incoming competition for the company's hepatitis C virus (HCV) treatments have been exacerbated by declining sales among its HCV drug-based treatments.

As a result, the stock is trading at a single-digit earnings multiple under the assumption it has reached a peak that it won't return to. Let me walk you through some figures, and soon you'll understand why this may be the the least risky stock in its industry.

Margin of safety

This term is a core concept of value investing, coined by the method's father, Benjamin Graham. His protege, Warren Buffett, has a knack for illustrating Graham's concepts, and in a famous example, he explained, "When you build a bridge, you insist it can carry 30,000 pounds, but you only drive 10,000-pound trucks across it." The extra 20,000-pound capacity is the bridge builder's margin of safety, and the same idea applies to stock investing.

Graham also had a disdain for the price-to-earnings ratio, preferring its inverse, the earnings yield (think earnings-to-price ratio). Whether you own an entire business or just some of its shares, the earnings yield is effectively your annual rate of return -- with caveats.

GILD PE Ratio (TTM) Chart

GILD PE Ratio (TTM) data by YCharts.

You might not be able to affect a company's earnings per share (EPS), but you can wait for a price that leads to an acceptable earnings yield. Viewed in this manner, the annual rate of return on Gilead Sciences stock based on its recent price and EPS over the past 12 months is a juicy 14.6%, assuming the company's earnings remain flat into eternity.

One caveat to viewing earnings yield as an annual rate of return is the simple fact that earnings aren't static -- which is where margin of safety comes into play. If Gilead Sciences' EPS this year meets estimates, the earnings yield will rise to 15.1%, and I expect it to rise further over the long term.

If I'm wrong, though, you would still enjoy a 10% rate of return if Gilead's earnings fell 31% from trailing-12-month EPS of $11.35 to just $7.80. A 31% margin of safety is a lot of wiggle room for error.

Acquisitive discipline

Another caveat to viewing an earnings yield as your annual rate of return is the simple fact that companies don't distribute all their earnings to shareholders and all too often make large acquisitions that never pay off.

Gilead Sciences is an outlier in this respect. It has made some relatively small purchases over the past couple of years, but it hasn't made a huge acquisition since buying Pharmasset for about $11 billion in order to get its hands on sofosbuvir, the vital component in its HCV antivirals.

Instead of bloating up with big acquisitions, it's been returning profits to shareholders through massive share repurchases and initiating a quarterly dividend program. The distribution offers a 2.4% yield at recent prices, and once deposited into your account, it's yours to keep no matter what unforeseen catastrophe strikes.

What about sliding sales?

In the second quarter alone, Sovaldi, Harvoni, and recently launched Epclusa contributed $4 billion to Gilead's top line. That's an incredible return on the 2011 Pharmasset acquisition, but 18.4% less than Sovaldi and Harvoni contributed during the same period last year. Rising sales for other products offset the loss somewhat, but second-quarter total revenue of $7.8 billion was still 5.7% lower than the prior-year period.

The entry of competing HCV antivirals from AbbVie and Merck has pressured sales of Gilead's HCV antivirals, but I don't expect sales to continue sliding much longer, for a few reasons. Gilead's Epclusa is the first and only pill to treat all six HCV strains, and the competition can't touch its safety profile.

More importantly, existing HCV treatments have only scratched the surface of their addressable patient population. There are an estimated 180 million people infected with HCV worldwide, and about 1 million of the roughly 3.5 million that reside in the U.S. are covered by Medicaid.

By law, Medicaid (and Medicare) programs are required to pay for medically necessary treatments, even if they're expensive. Epclusa's list price is $74,000, although Gilead will most likely record far less revenue for each patient treated. Across the nation, states are lifting restrictions that limit the pricey treatments to the sickest patients, because plaintiffs in class-action lawsuits are on a winning streak. 

Image source: Gilead Sciences.

Epclusa earned FDA approval on June 28, and by the end of the second quarter, just two days later, Gilead Sciences had already recorded $64 million in sales of the combo pill. That's not bad for a couple of days, but the $11.7 billion annual run rate it implies should be taken with many grains of salt because of general inventory stocking practices. More recently, healthcare analytics firm IMS Health reported that the number of new Epclusa prescriptions during the week ended Aug. 5 had risen 27.6% over the previous week, following a 24.6% rise in the week before that.

Putting it together

While I believe Epclusa will allow Gilead's sales to return to growth in the years ahead, it's too early into its launch to be certain. If the company revises its 2016 total sales forecast downward when it reports third-quarter earnings, then the stock price will most likely dip again.

The important important takeaway is this: The margin of safety is so wide, long-term investors scooping up shares at recent prices can look forward to an acceptable rate of return, even if I'm wrong.