phrase: refers to someone deceased in a military accident or operation. Phrase predates World War II, but came into common use at that time due to the large numbers of training casualties due inexperienced pilots/crewmembers trained in aircraft that are much less reliable than today. Common accidents in rural areas would result in aircraft crashing into barns, fields, or rural property, resulting in damages. The US Government would compensate the affected property owners with checks to pay for damages, or in some cases condemn land contaminated with undetonated/unlocated munitions/weapons, in effect "buying the farm".

"28 of us started out in my class in UPT (Undergraduate Pilot Training) but only 11 of us earned our wings. 13 washed out, 2 got held back, and Higgins and Baker bought the farm when they lost power on climb-out."

Mrs Tiggywinkle? It's PC Bobs, here. I'm afraid I have some upsetting news. Your husband was crossing the M4 and, well I'm afraid he bought the farm. Squashed flatter than a witch's tit. He was.
We scraped Him up as best we could. He's in this bucket. I shouldn't look if I were you.

1.To fail in the most complete way, without understanding how. This originates from the linux error code "EIEIO" which refers to an error which makes no sense, and cannot be repaired.
2.To die

"Jet pilots say that when a jet crashes on a farm the farmer usually sues the government for damages done to his farm by the crash, and the amount demanded is always more than enough to pay off the mortgage and then buy the farm outright. Since this type of crash is nearly always fatal to the pilot, the pilot pays for the farm with his life, and has bought the farm."

With definition 1, the metaphor of buying the farm is often elaborated upon:
*dave makes a big mistake*
jeremy: You just bought the farm.
The minister of agriculture wishes to speak urgently with you.