A few weeks ago, I noted that the USDA had high hopes for corn production this year. Farmers eventually managed to plant a huge crop, despite long delays caused by a rainy spring. However, I expressed concern that the delays pushed too far into the season, and would make for an unhealthy crop. I also suggested that investors shouldn't be too quick to sell off shares of fertilizer companies, which would benefit from high corn prices.

Scarcely a month later, I've been proved right on both accounts. Corn prices are up nearly 20% in the interim, as more traders in the futures market come to question the USDA's recent estimates of crop health, especially given last week's abnormally hot weather. Meanwhile, fertilizer stocks are outperforming the broader market by a healthy margin. Terra Nitrogen (NYSE: TNH), which I singled out in an earlier article, is even up about as much as corn, while its parent, CF Industries (NYSE: CF) is up nearly 8%.

But high prices aren't sweet for everyone
But there's a flipside to all this. While some companies in the farming sector are benefiting from high crop prices, others are struggling terribly. Take Archer Daniels Midland (NYSE: ADM), whose business model benefits from a booming farm industry in some ways, but also feels the pinch in others.

About 23% of the company's profits come from its agricultural services segment, which helps farmers store and transport their crops. High crop prices are good for this segment, since farmers can pay more for ADM's services, and are likely to plant more and thus have more crops to transport.

But ADM is also one of the biggest producers of high fructose corn syrup, and here high crop prices are bad, because they represent an input cost. Strong demand for HFCS and other sweeteners wasn't strong enough to offset the costs of production; profit on ADM's sweeteners dropped over 90% in the most recent quarter, all the way from $119 million to just $9 million. While overall gross profits increased, the stunning decline in the corn segment caused margins to shrink from an already-narrow 5.9% to 4.8%.

Playing chicken
Another industry getting hammered by high corn prices is the poultry industry. Corn and soy are the main components of chicken feed, and while soy hasn't had nearly as big a run as corn, chicken feed is carefully formulated, and the two aren't interchangeable. This has meant that anyone in the business of raising chickens, whether for eggs or meat, has seen costs rise considerably, while an oversupply of chickens has kept selling prices down.

The normal response would be to cut production until prices improved, but for a while, many poultry companies were still trying to outproduce each other to gain market share. That game finally seems to be ending.

Pilgrim's Pride (NYSE: PPC) announced last week that it would close a plant in Texas and lay off 1,000 workers in an attempt to reduce costs. This environment has been difficult for Pilgrim's. After emerging from bankruptcy a year ago, the company has already resumed the path to decline, suffering losses of nearly $250 million in the first half of the year.

Pilgrim's Pride isn't alone, either. Egg-producer Cal-Maine Foods (Nasdaq: CALM) reported higher sales in the most recent quarter, but still saw its profit drop 65% because of high feed costs. Cal-Maine is doing the right thing by trying to focus on sales of its specialty eggs, which carry a higher selling price, but growth in those higher-margin products wasn't enough to outweigh the growth in costs. Meanwhile, Tyson Foods (NYSE: TSN) saw a 68% drop in profits in May, and with feed costs even higher now, the earnings announcement coming up on Monday can't possibly be good.

The Foolish bottom line
High commodity costs aren't always bad, depending on who you're asking. Farmers and crop nutrient companies are certainly loving these high corn prices. The companies that have to buy the corn for use in their products, however, are having a terrible time. In some cases, like poultry, it's very difficult to pass those increased costs on, because the product is also a commodity, and has its own pricing formulas based not on cost of production but on supply and demand. Because everything is connected, a rainy day in Iowa can mean the difference between profit and loss for the right investments.