Cattle farmers struggling with record corn prices are feeding their cows candy instead.

That's right, candy. Cows are being fed chocolate bars, gummy worms, ice cream sprinkles, marshmallows, bits of hard candy and even powdered hot chocolate mix, according to cattle farmers, bovine nutritionists and commodities dealers.

"It has been a practice going on for decades and is a very good way to for producers to reduce feed cost, and to provide less expensive food for consumers," said Ki Fanning, a livestock nutritionist with Great Plains Livestock Consulting, Inc. in Eagle, Neb.

Feeding candy to cows has become a more popular practice in tandem with the rising price of corn, which has doubled since 2009, fueled by government-subsidized demand for ethanol and this year's drought. Thrifty and resourceful farmers are tapping into the obscure market for cast-off food ingredients. Cut-rate byproducts of dubious value for human consumption seem to make fine fodder for cows. While corn goes for about $315 a ton, ice-cream sprinkles can be had for as little as $160 a ton.

Related: Feds offer help to drought-stricken farmers

"As the price of corn has climbed, farmers either sold off their pigs and cattle, or they found alternative feeds," said Mike Yoder, a dairy farmer in Middlebury, Ind. He feeds his 400 cows bits of candy, hot chocolate mix, crumbled cookies, breakfast cereal, trail mix, dried cranberries, orange peelings and ice cream sprinkles, which are blended into more traditional forms of feed, like hay.

The farmer said that he goes over the feed menu every couple of weeks with a livestock nutritionist who advised him to cap the candy at 3% of a cow's diet. He said that the sugar in ice cream sprinkles seems to increase milk production by three pounds per cow per day.

Sugar also helps to fatten up beef cattle, according to livestock nutritionist Chuck Hurst, owner of Nutritech, Inc., in Carmen, Idaho, without any ill effects to the cow, or to the person consuming its meat or milk. He said that it's the sugar in the candy that's important, and that it provides "the same kind of energy as corn."

He added that farmers feed their cows a wide assortment of byproducts beyond candy to save money.

"One guy in Montana bought a whole carload of soda crackers as feed," he said. "He had to hire a guy to open all the boxes of soda crackers."

Yoder and other farmers buy their feed from brokers like Midwest Ingredients, Inc., of Princeville, Ill., which offers a wide assortment of byproducts, including cherry juice, fish meal, peanut butter, fruit fillings, tapioca and left-over grain from distilleries.

Related: Meet the largest landowner in America

"The buyers of corn, or feed in general, are paying a lot of money so they're definitely out there shopping around looking for cheaper stuff," said Eric Johnson of Eagan, Minn., who owns MidWest Feed Ingredient Trading. "People are price conscious and they're resourceful. Stuff comes up and they hunt it down and try to save a little bit of money."

But there is a catch -- as the demand for candy-feed goes up, so does the price. Yoder said that he has become "more aggressive in bidding for [candy-feed] because of the high price of corn." But he added that the candy "started getting expensive because other people want it too."

Yoder said he's seen the price of sprinkles rise from $160 per ton -- which was about half the price of corn -- to about $240. But he still buys the candy.

"Any time I can make a change to save two cents or three cents a cow, that makes a difference," said Yoder. "Farming is a game of inches sometimes, or half-inches. Every little penny you can find to save, you do."