farm (n.)
c.1300, "fixed payment (usually in exchange for taxes collected, etc.), fixed rent," from Old French ferme "rent, lease," from Medieval Latin firma "fixed payment," from Latin firmare "to fix, settle, confirm, strengthen," from firmus "firm" (see firm (adj.)).

Sense of "tract of leased land" is first recorded early 14c.; that of "cultivated land" (leased or not) is 1520s. Phrase buy the farm "die in battle," is at least from World War II, perhaps a cynical reference to the draftee's dream of getting out of the war and going home, in many cases to a peaceful farmstead. But fetch the farm is prisoner slang from at least 1879 for "get sent to the infirmary," with reference to the better diet and lighter duties there.
farm (v.)
mid-15c., "to rent (land)," from Anglo-French fermer, from ferme (see farm (n.)). The agricultural sense is from 1719. Original sense is retained in to farm out.