The phrase over the counter is widely used to characterise the drugs that can be legally bought without a physician’s prescription, and is so used in the countries in which these drugs are not in fact bought over any kind of a counter, in the literal sense. They are displayed on self-service shelves and the customers simply pick them up and pay for them; the payment may be done at a counter, but the transaction does not involve their being handed over the counter.
That is, of course, not particularly puzzling in itself: one could point out that, once upon a time, such drugs were handed to the customers over the pharmacy counters (as they still are in many parts of the world), and that the phrase then remained after the modernisation of the pharmacies. It is not at all uncommon for the meaning of an expression to be stretched in such a way. After all, the phrase over the counter itself is also used in the world of finances, and the kind of stock to which the phrase refers is not bought and sold over any kind of counters in the literal sense.
What is, however, puzzling about the use of the phrase in the context of drugs is that its only purpose is to convey that the drug in question is not of the kind for which a prescription is required, and the drugs of the latter kind are always dispensed over the counter, in the literal sense. To obtain such a drug a customer has to walk to some counter, hand the prescription to a pharmacist who is standing on the other side of the counter, and the pharmacist then, after getting the drug ready, hands the drug over the counter to the customer.
So the question is not how did the phrase end up being stretched beyond its literal meaning (that itself wouldn’t be strange), but why was it chosen as the term for something (non-prescription drugs) that stands in contrast to things to which it readily does apply in the literal sense (prescription drugs).
General-purpose dictionaries provide the meaning of the phrase, but are of no help in resolving this puzzle. Readily available sources of general information about over-the-counter drugs do not discuss why they are so called.
To summarise your question, you are asking about the phrase “over the counter” and you use as an example the experience at chemists/druggists in which “over the counter” items do not necessarily and literally go “over the counter”, whereas prescription only medicines do go “over the counter.”
You seem to assume that there is a literal passing of the purchase over the counter. There would have been at one time, but this is not the essence of the phrase.
Language and phrases develop: We say we dial a telephone number - but modern telephones have no dial.
The earliest mention (that I can easily find) of “over the counter” in a retail sense is from a publication by “The Business Historical Society Inc. 1823” entitled "Past, Present & Probably the Future State of the Wine Trade" By James Warre:
Mr. Barker, a licensed victualler in Holborn, “sells retail over the counter, in glasses, a pipe and a half of Port wine in a week. Some drink at the counter, others take it away in small bottles. The principal customer are small tradesmen, ..."
Here, “over the counter” has already taken on a figurative meaning: “directly to the consumer and without formality and restriction” and this is in contrast to sales of wine to a restricted group, i.e. members of the trade.
The figurative sense of “over the counter” is thus “without restriction/formalities” and it has been for over 200 years.
So he took me on a tour of the multiple gun stores and pawn Shops not far from the famous Vegas Strip. Our mission - to see if I could buy a gun over the counter. SBS News (2017) https://www.sbs.com.au/news/i-tried-to-buy-a-gun-at-a-las-vegas-department-store
Answered by Greybeard on August 9, 2020
This source  suggests comparing the expression to under the counter (and its American variant 'under the table'), the meaning of this expression being secret and often illegal transactions.
If we examine the etymology for under the counter, there are two origin stories found here:
a  "In Britain, during the Second World War, shopkeepers sometimes kept articles that were in great demand under the shop counter. They only sold them to special customers, often charging very high prices for them."
b  "the counter [is] the flat-surfaced furnishing or table over which legal business is conducted."
This background suggests to me the following suspicion. Perhaps non-prescription drugs are referred to as over the counter because there isn't much chance of their being involved in secret or illegal transactions. Such a loss of opportunity for underhandedness entails a loss of opportunity for under the counter business dealings. Moreover, we may also surmise, with inference from the first origin story, that non-prescription drugs are in less demand than their counterparts and hence provide less incentive for being kept under the counter for those special customers.
: McGraw-Hill Dictionary of American Idioms and Phrasal Verbs. S.v. "over the counter."
: Collins COBUILD Idioms Dictionary, 3rd ed.. S.v. "under the counter."
: The American Heritage Dictionary of Idioms by Christine Ammer. S.v. "under the counter."
Answered by touchstone on August 9, 2020
It could be that the idea in specifying those sales as OTC is that only a counter is involved, this counter standing symbolically as a transaction solely between buyer and pharmacist, whereas "not OTC" involves a third party in the transaction.
Answered by LPH on August 9, 2020
1 Asked on May 26, 2021 by dai_lizhi86
1 Asked on May 26, 2021
2 Asked on May 26, 2021 by atoth
2 Asked on May 26, 2021
1 Asked on May 26, 2021
4 Asked on May 26, 2021
4 Asked on May 26, 2021 by technophyle
2 Asked on May 25, 2021 by cool-elf
1 Asked on May 25, 2021
2 Asked on May 25, 2021 by user274438
2 Asked on May 25, 2021 by hrl
0 Asked on May 25, 2021
17 Asked on May 25, 2021 by colin-t-hart
0 Asked on May 25, 2021 by anthony-darienzo
3 Asked on May 25, 2021
Get help from others!