The saying "There's no free lunch," as I understand it, refers primarily to hidden costs. I believe it's commonly used in situations where people think they're getting something for free.
For example, imagine someone screaming "Hooray! I just won a prize - a free car!"
Someone else might reply, "There's no such thing as a free lunch," advising the winner to read the fine print. Will they have to pay taxes on the car? Will they have to buy insurance for it? Are there other hidden costs they need to be aware of?
The phrase doesn't have to be restricted to economics. For example, imagine someone building a resort on a remote, beautiful beach. They think it's the perfect gig, but they may actually miss certain things back in the city. Moreover, tourists who visit the resort will make the beach a little less remote and a bit more polluted.
On a bit of a tangent, I found this statement intriguing: "Campbell McConnell writes that the idea is 'at the core of economics.'" I've long said that "There's no free lunch" is the fundamental law of economics. In other words, you can't create wealth out of nothing.
In that spirit, one could loosely use "There's no free lunch" as a corollary of the basic scientific maxim that matter can neither be created nor destroyed. Instead of writing all those complex mathematical formulas, Einstein could have just said "There's no free lunch."
(I just discovered that the Wikipedia article I linked to mentions the science link... "In the sciences, TANSTAAFL means that the universe as a whole is ultimately a closed system.")
Wikipedia's article There ain't no such thing as a free lunch has some information on the origin of the phrase.