With commodity prices hitting new highs, it's surprising that Hershey (NYSE:HSY) posted a second-quarter gross margin increase of 330 basis points year over year. After all, milk prices alone are up 13% in the same period; that's bound to cut into Hershey's milk chocolatey profits, right?

Actually, no. Hershey's cost of goods sold stayed even year over year on a 5.1% increase in sales. The culprit for Hershey's downfall was selling, general, and administrative expenses, which increased by a whopping 23%. Last month, Hershey did announce its initiative to increase advertising levels by 20% this year and next to meet its goal of 3%-4% sales growth. This quarter would have included advanced advertising for key summer promotions, including Hershey's linkage with the wildly popular The Dark Knight movie. Still, an increase in advertising alone isn't enough to drive SG&A to these decidedly sour levels.

Hershey's balance sheet hasn't fared much better. Its cash position has dramatically decreased over the past year, down almost 65% to $45 million, from last year's $129 million. Meanwhile, inventory increased by more than 16% year over year.

Things won't get any easier for Hershey, given Wrigley (NYSE:WWY) and Mars's pending candy-coated combination. Rumors of a Cadbury Schweppes (NYSE:CSG) and Hershey merger have quieted lately, but such a deal could end up becoming a necessity against the combined market strength of Wrigley-Mars.

The next few quarters will be telling ones for Hershey. It's time for the company to start generating additional profit gains from the supply-chain-management improvement program it's been working on for the past year. Hershey has capitalized on Asian market growth with its Indian joint venture, and it's building domestic market potential in a strategic product alliance with Starbucks (NASDAQ:SBUX). Earnings will remain bittersweet, though, if Hershey can't get its costs in line with revenue growth.

Fulfill that sweet tooth with further Foolishness: