That old war film reference rings true for me. Wasn't it Sgt. York? I have no idea when or where I first heard the expression, but always thought and assumed it meant to crash the plane. Just dying in one's sleep does not qualify as buying the farm--you have to crash and burn in some manner, to go out in a "blaze of glory."
Wordmatic
Posts: 1390 | Location: Near Philadelphia, Pennsylvania, USA
SECOND EDITION 1989 16. In slang use. a. To suffer some mishap or reverse; spec. to be wounded; to get killed, to die; (of an airman) to be shot down. Freq. with it.
1825 W. N. GLASCOCK Naval Sketch-Bk. (1826) I. 30 Never mind, in closing with Crappo, if we didn't buy it with his raking broadsides. 1920 W. NOBLE With Bristol Fighter Squadron v. 70 The wings and fuselage, with fifty-three bullet holes, caused us to realize on our return how near we had been to ‘buying it’. 1925 FRASER & GIBBONS Soldier & Sailor Words 41 To buy, to have something not desired, such as a job, thrust on one unexpectedly, e.g., ‘Just as he was going out, he ran into the Corporal and bought a fatigue.’.. Another meaning: to be scored off or victimized. Of a man getting an answer to a question which made him ridiculous: ‘He bought it that time.’ 1943 HUNT & PRINGLE Service Slang 39 He bought it, he was shot down. 1943 C. H. WARD-JACKSON Piece of Cake 16 He's bought it, he is dead that is, he has paid with his life. 1944 J. E. MORPURGO in Penguin New Writing XXII. 11 I'm afraid we want you elsewhere... Jim Barton bought it, and you'll have to take on his troop. 1953 R. LEHMANN Echoing Grove 261 He'd lived in London before the war, but the whole street where he'd hung out had bought it in the blitz.
DRAFT ADDITIONS SEPTEMBER 2006 orig. U.S. Mil. to buy the farm (also ranch, plot, etc.) [perh. with allusion to the notion that a farmer whose farm is damaged by a military plane crash would be owed restitution by the government]: (of a pilot or aeroplane) to crash fatally; (hence) to be killed; to die (cf. BUY v. 16a).
[1938Amer. Speech13 308/2 Bought a car (or telephone pole, etc.), a driver is to blame for an accident.] 1954N.Y. Times Mag. 7 Mar. 20/1 [In a glossary of jet pilots' slang] Bought a plot, had a fatal crash. 1963 E. M. MILLER Exile to Stars (1964) 29 The police dispatcher says a plane just bought the farm. 1968 K. COOPER Aerobics 125 If the clot is in a coronary artery, you've bought the farm. 1976 C. R. ANDERSON Grunts 154 They don't do nothing for a guy till after he buys the ranch. 1989 D. KOONTZ Midnight I. xi. 296, I was in surgery, having a bullet taken out of my chest, and I almost bought the farm. 1999 S. RUSHDIE Ground beneath her Feet (2000) xi. 322 For one hundred and fifty seconds he genuinely checked out, kicked the bucket, bought the farm. Ormus the flatliner.
Wordorigins has a couple more quotes, and mentions become a landowner and bought a packet.
My father used to use that expression and he was a career Air Force pilot. He gave me an entirely different (and less convincing) explanation for it, though.
I also heard it when I was growing up in Wisconsin, and my father wasn't in the military, though my grandfather was in the army. I think the phrase has been around longer than WWII. Since the OED cites similar quotes (such as "to buy it") much earlier, I suspect it merely evolved from that.