If it was in the lungs it was probably mold from something they were fed.
Cows and horses are no different than people when they breath in mold and grain dust.
Lungs fill with fluid.
One of the reasons for putting molasses on oats for horse feed, keeps the dust down so they don’t breath it in.