Image source: Barrick Gold

The commodity market has punished miners for years, and pretty much across the board. But that all started to change early this year. And that's why Barrick Gold Corporation (GOLD -1.02%), Teck Resources Ltd (TECK -0.20%), and Coeur Mining Inc (CDE -1.51%) are all up in the triple digits through mid May. The stories behind these three stocks that are up over 100%, however, are all different.

A gold giant

Barrick is one of the world's largest gold miners. However, when the commodity downturn started in 2011, Barrick entered a rough patch with more debt than investors were comfortable with. Its shares were hit pretty hard, falling by around 90% between 2011 and the start of this year. Clearly, declining precious metals prices were a big part of that, but leverage played a helping hand.

During that painful stretch, Barrick sold assets, streamlined its operations, and cleaned up its balance sheet. In fact, during the company's annual meeting in April, Executive Chairman of the Board John Thornton announced, "Barrick is back," suggesting that the turnaround was complete. A rising gold price has been an added tailwind. That said, Barrick's debt still accounts for roughly 55% of the company's capital structure, which could turn into a question mark again if commodities start to fall anew.

So, for investors looking at the company's nearly 140% price gain this year, things are getting better, but don't overlook the risks still inherent to the investment.

ABX Chart

ABX data by YCharts

Cash for growth

Teck Resources mines metallurgical coal (used in steelmaking), copper, and zinc. The shares are up nearly 145% or so this year. As with Barrick, there are really two stories here.

The first story is the obvious one: Commodity markets are starting to turn higher again. That's helping Teck's top line. During the downturn, like most miners, Teck worked hard to cut costs and rightsize its business. So, higher commodity prices are going to show up more quickly on the bottom line. However, dig under the covers a little, and there's another story you need to understand.

A few years ago Teck bought into an oil sands project. At the time, oil prices were high and the deal looked like a winner. Then oil prices crashed in mid-2014. Suddenly, that project, and the multibillion-dollar cost, looked like a weight that would drown the miner. Fast-forward to the first quarter, and Teck has about $1 billion left to spend, with roughly $1.3 billion of cash on the balance sheet and some $3 billion on an undrawn line of credit. In other words, it no longer looks like paying for the oil sands project will be an issue. And with oil prices up off their lows, the project doesn't look like such a loser anymore, either.

Of the three companies here, Teck probably has the most compelling story behind it. That's particularly true since the oil investment will add a fourth major commodity to Teck's mix, materially increasing the company's diversification.

Image source: Coeur Mining.

At the margins

Like most miners, Coeur Mining has been working hard to trim costs. That's really important here, because this silver and gold miner's costs have been higher than the price of what it sells lately. For example, in the first quarter the company's adjusted all-in sustaining costs for silver were roughly $16 an ounce. Silver didn't leap above the $16-an-ounce level until early April. Which helps explain why Coeur's adjusted net income in the first quarter was a loss of $0.04 per share. (For comparison, Barrick's adjusted net income was $0.11 per share in the most recent quarter.)

However, the company's mining costs also help explain why Coeur's shares are up more than 200% this year. Essentially, with commodity prices moving higher, this marginal miner might actually start turning a consistent profit. Investors appear to be pretty excited by that prospect. But don't overlook the risks. If precious metals prices retreat, Coeur's stock is likely to get hit harder than better situated miners.

That's a good story

We all love a good story stock, and Barrick, Teck, and Coeur each have an interesting tale to tell. With huge price gains so far this year, however, you need to be careful that the story doesn't blind you to some of the risks. That's particularly true for a marginal miner like Coeur, but also worth thinking about with a turnaround play like Barrick. Teck, meanwhile, may have the best prospects of continuing its run, assuming that its oil investment pans out as expected.