There's no such thing as a free lunch
The economic theory, and also the lay opinion, that whatever goods and services are provided, they must be paid for by someone - that is, you don't get something for nothing. The phrase is also known by the acronym of 'there ain't no such thing as a free lunch' - tanstaafl.
Before discussing the origin of 'there's no such thing as a free lunch' it would be useful to go back to the days in which lunches were free. Free lunch was a commonplace term in the USA and, to a lesser extent in Britain, from the mid 19th century onward. It wasn't used to describe handouts of food to the poor and hungry though, it denoted the free food that American saloon keepers used to attract drinkers; for example, this advertisement for a Milwaukee saloon, in The Commercial Advertiser, June 1850:
At The Crescent...
Can be found the choicest of Segars, Wines and Liquors...
N. B. - A free lunch every day at 11 o'clock will be served up.
Free lunches, often cold food but sometimes quite elaborate affairs, were provided for anyone who bought drink. This inducement wasn't popular with the temperance lobby and was also criticized for the same reason that others in the 20th century later introduced the TANSTAAFL idea to economic thinking, that is, saloon customers always ended up paying for the food in the price of the drinks they were obliged to consume. Indeed, some saloon keepers were prosecuted for false advertising of free lunch as customers couldn't partake of it without first paying money to the saloon.
It was into this context that the economic theorists enter the fray and 'there's no such thing as a free lunch' is coined. It isn't known who coined the phrase. It certainly wasn't the economist Milton Friedman, who was much associated with the term. He was a celebrated Nobel Prize-winning economist and his monetarist theories were highly influential on the Reagan and Thatcher administrations in the 1980s and 90s. Friedman certainly believed that 'there's no such thing as a free lunch' and he published a book with that title in 1975, but wasn't, and never claimed to be, the originator of the phrase.
The phrase appears to have come about in response to the libertarian views of Henry Wallace, the US Vice President between 1941 and 1945. He wrote an article which was originally published by The Atlantic Monthly in which he suggested a post-WWII worldwide economic regime offering "minimum standards of food, clothing and shelter" for people throughout the world and offering the opinion that "If we can afford tremendous sums of money to win the war, we can afford to invest whatever amount it takes to win the peace". Paul Mallon, a Washington journalist, responded to Wallace's article with a critical piece, published in several US papers, including The Lima News, January 1942:
"Mr. Wallace neglects the fact that such a thing as a 'free' lunch never existed. Until man acquires the power of creation, someone will always have to pay for a free lunch.
The first record I can find of the precise phrase there's no such thing as a free lunch, comes following year, in an editorial in The Long Beach Independent, October 1943, again referring to Wallace:
"Some people say there is no such thing as a free lunch, but you listen to a fireside chat from Washington, and the voice will tell you all about it, and how you can make something for nothing."
The 'there ain't no such thing as a free lunch' version of the phrase is often reduced to the acronym TANSTAAFL. This is widely associated with the science fiction writer Robert Heinlein. he did used the term several times in his 1966 novel The Moon is a Harsh Mistress, but the coinage of the acronym pre-dates that by at least a quarter of a century. The earliest citation I can find for tanstaafl is from October 1949, when it appeared in a book review published in several US newspapers, including The Independent Record:
Now, our secret: Tanstaafl is mnemonic for "there ain't no such thing as a free lunch."
See other phrases that were coined in the USA.