The Netherlands, (in)famous for their liberal drug policy, have so-called coffee shops, ie. hash bars, where the purchase and use of cannabis products is tolerated.

AFAIK, it is not really legal, because just like most countries on this planet, the Netherlands have signed international treaties that keep them from legalizing THC. But apparently, they decided to set different priorities on what to prosecute - the Netherlands' policy is to let the police do real police work (ie. prosecute crimes that actually do harm to someone), while the possession of small amounts of hash (and some other drugs, e.g. magic mushrooms) is tolerated.

The main argument for tolerating public places where drugs are sold and purchased is this: a coffee shop is a place that authorities can keep an eye on without having to invade someone's privacy, which is a very much regarded ideal in the Netherlands. Compared with a "private" drug dealer, a coffee shop owner is much less likely to start to sell hard drugs, because (s)he would risk a highly profitable business. There's your chance to keep hash users from getting in touch with hard drugs - and, weird enough, this seems to work, at least to a degree.

Now, as marijuana and hash are still illegal products, they cannot be taxed. So there's an agreement of some sort: coffee shop owners sell weed and hash, but to the IRS-like institution they report that they've sold huge amounts of coffee. I gather that's why they're called coffee shops.

From experience, I can tell you that there are coffee shops that don't really sell coffee or any liquid at all, perhaps with the exception of hash oil.