"Free as in beer" is a phrase (loosely coined by Richard Stallman) to indicate that something does not cost money. This is as opposed to "free as in speech", meaning that it comes with no restrictions.
I've been on the internet for decades, and that phrase never sat well with me; Beer Money is a real phrase, and AFAICR I've always been required to tender a fee for the right to undock a beer container from the beer-temperature-control-apparatus or purge beer fluid from a heat controlled storage vessel.
Have you never been invited over and been offered to fetch yourself some beer from the fridge? It'd be weird for a friend to require you to tender a fee before doing so, and they'd also be quite annoyed if you started stockpiling the beer being offered to you and started reselling it. In my mind the phrase conjures the right frame of mind: "Hey! Check out this piece of code I've written, friend! Feel free to use it!"
You have gotten many decent replies already. I think one thing that is missing is that the phrase talks about "free as in free beer". So it is not a statement that beer in general is free, it is a clarification that we want the meaning of "free" as in the phrase "free beer". In other words: At no cost. ("gratis")
This is in contrast to "free" as in "free speech", which is about freedom/liberty. ("libre")