Considering the price of producing each copy of the magazine, the magazine owners would have to sell more advertising to cover its costs, but advertisers are more interested in targeting the specific markets they intend to sell for, not accidentally advertising to secondary markets that are not actually interested. That would be a waste of their capital, so advertisers prefer audiences whose demographics are well understood.
Furthermore, a wide proportion of the audience may in fact be poor, too poor to buy the advertisers' products. Thus giving away the magazine for free would attract the frugal, the wrong crowd for the intended purpose of producing a magazine.
Therefore, magazines charge $5 (or an equivalent amount in whatever currency you use) as the cover price to limit the audience to only those people who are intrinsically interested in the content. $5 is about the level where people will make a conscious decision not to purchase something because of value to them. Thus, it serves as a useful barrier to entry of anyone who does not fit its intended target audience, and that means it can sell this very specific target to advertisers looking for that target market. It's an EconomicSolution.
What's important about the structure of this fee is that anyone (with $5) can buy the magazine. There is no other filter other than the price, so it is not a limit to access except along economic lines. Since the price is low enough that almost anyone can reasonably be given the opportunity to read the magazine, or at least those willing and able to spend $5. Those unwilling or unable to spend $5 are unlikely to purchase the advertisers' products, so it is also a useful filter in that respect. And if the readers no longer are interested in the magazine, they simply do not buy the next issue; or they may choose to only by the issues they are interested in.
Also, since the purchase of the magazine is done at the newsstand, there is no connection between the reader and the magazine editors and by extension the advertisers. That means the access is relatively anonymous (AnonymousCash?). Many advertisers therefore include give aways and contests to solicit personal information from their readership, but none of that is a prerequisite for access.
Further, since there is no connection from the reader to the content providers, then there is no obligation from the content providers to the reader. The relationship is entirely mediated.
For online providers, the size of the typical transaction is often very small. MicroPayment has been proposed as a solution to this.
Actually, some magazines manage to be free and attract an audience. Take Metro for instance.