Coined by Heinlein in The Moon is a Harsh Mistress.It's far older than that. At least a 150 years old.
Bars used to provide free lunches to encourage people to buy more drinks. Often very cheap and salty lunches, like stews or corned beef. This was very common in the 1920's-1940's, decades before Heinlein. It later evolved into just bowls of peanuts or pretzels on bars, though I haven't seen a bar with complimentary beer nuts in years.
The stew looked like a free lunch, but there's no free lunch because you paid for it in drinks.
Skimming this link: https://quoteinvestigator.com/2016/08/27/free-lunch/ shows it was in print at least back in 1886.