I'm not sure about you, but whenever I stumble upon a company that matches my criteria as the "ideal" investment, I can't help but get excited. Just the thought that I may have found the one hidden gem in the market that simply cannot lose brings me immeasurable joy. However, after the sense of euphoria wears off, I begin asking myself why it is that the company in question seems so amazing. Oftentimes, I find that the investment opportunity truly is attractive but, every so often, I realize that it may be just another value trap.

Now, before I continue, let me define value trap in this context. As opposed to saying value trap and meaning a company whose fundamentals are so poor that it could crash and burn when its fundamentals actually look deceptively good, I define value trap as a company whose fundamentals are actually great now and whose stock appears to be undervalued, but whose future doesn't look quite that nice. In this second scenario, the company may have a few years of increased profitability ahead of it but the market understands its longer-term prospects so much that they are pricing in a slightly less fortunate future. This is, I believe, the case with CF Industries Holdings (NYSE:CF).

Company Data
CF is a company that appeals to me in every way. Founded in 1946, it has a long history of operations, and it is a very simple business that engages in one of the most necessary forms of enterprise in history; fertilizer. To top this off, the company has an ROE of 29.2%, an operating margin of 34.4%, a net profit margin of 19.2%, and a free cash flow margin of 22.7%. This is all on top of trading at a paltry 6.8 times earnings! By every measure I could think of, this company, as well as peers like Terra Nitrogen (NYSE:TNH), Potash Corp (NYSE:POT), CVR Partners (NYSE:UAN), and The Mosaic Company (NYSE:MOS), are gorgeous (though please don't tell my girlfriend I said that, as she might get jealous...or since it's fertilizer I'm talking about here, she might get offended...either way, SHHH!).

After thinking about this amazing industry and the fact that it was all very cheap and very attractive, I had an epiphany; this is fertilizer we're talking about here, not tech! Why in the world is a very commodity-oriented business so unbelievably flawless? That's when I concluded that something must be wrong and that, in order to figure out what it was, I would need to dig deeper. What I found was astonishing. Apparently, there are two major things that determine how profitable a fertilizer company is: the cost of natural gas on the company's bottom line, and the price of corn on the company's top line.

Natural Gas
Let's begin with natural gas. According to CF, natural gas accounted for 39% of its nitrogen-based fertilizer's costs in 2012 (inclusive of depreciation and amortization costs too). This is particularly interesting to note because, as the price of natural gas rises, the margins of these highly profitable companies should decline, ceteris paribus. Just as an example, holding all else the same and adjusting taxes accordingly, a doubling in the cost of natural gas would have decreased CF's net income by about 51.2%. Although you may make the statement that the odds of natural gas prices doubling in a short period of time are slim to none, I wouldn't be so sure. According to the EIA, the price of natural gas in April of 2012 reached the lowest it had ($1.89 per thousand cubic feet) since March of 1999. I've taken the data and replicated it in the graph below for your viewing pleasure.

Natural Gas Price Chart

While I believe it is unlikely that we see an extended period of high natural gas prices, the EIA has noticed that they are slowly on the rise and will likely continue on this path as the excess supply that has built up from the fracking boom in the United States works itself out, eventually leading to reasonable supply levels sometime in 2016.

Now that we understand the bottom-line explanation for the industry's increased margins, we need to understand its explosive top-line growth. In essence, the price of corn is near its all-time highs because of the boom in the demand for biofuels, which has caused farmers to produce more, almost irrespective of the costs associated with doing so. But, there is one thing to be cautious of with the whole corn biofuel trend moving forward, and that is the cost of substitutes. Unfortunately for fertilizer lovers, soybeans, which don't require nitrogen-enriched fertilizer, can be substituted for corn in the event that corn prices rise too much. But is this likely to happen anytime soon?

Soybeans Vs Corn

According to this data I collected, the opposite has happened. While the price of corn has increased, the price of soybeans has increased somewhat more, indicating that, absent alternatives for corn like other cellulosic biofuels such as algae, corn prices may still have room to run before being hit by a fundamental downturn.

No matter how you slice it, data points to a world with at least slightly lower profit margins for fertilizer companies due to a very easy-to-see shoring up of excess natural gas supplies. However, the picture pertaining to corn leaves one wondering what will transpire over the next few years. Like I said, absent affordable corn substitutes, as well as technological leaps, it would appear that the top line of fertilizer companies may grow further, meaning that a healthy industry giant like CF could make for an amazing investment for Fools like us! 

Daniel Jones has no position in any stocks mentioned and will not buy shares in any of them for at least 30 days. The Motley Fool owns shares of CF Industries Holdings. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy. Is this post wrong? Click here. Think you can do better? Join us and write your own!