I'm American. My understanding is that in the US you need a prescription from a licensed healthcare professional to get medication from a pharmacy. This usually means a doctor but in some states a physician's assistant may have the authority to write prescriptions.
In the US, if it doesn't require a prescription, it is sold over the counter, though they may check your ID to see if you are a legal adult for some things.
I have heard anecdotally that in other countries pharmacists can sometimes dispense medication without a prescription.
HN is a very international discussion space. This fairly often leads to people speaking past each other as their comments may well be rooted in a completely different set of assumptions and mental models about how such things work.