The "sticker price" of a drug is called the "usual and customary price" (U&C). This is supposed to be what you charge for a drug, and is generally based on the "average wholesale price" (AWP) of the drug plus a dispensing fee to cover other costs. The AWP, however, may or may not (usually not in the case of generic drugs) be related to the actual acquisition cost of the drug. It tends to be substantially higher.
The pharmacy bills its U&C price to the insurance company (or, more often, a pharmacy benefit manager (PBM) contracted by the insurance company), and the insurance company tells you what it will actually pay you—this can be negative—and how much to charge the patient. Usually the pharmacy gets paid whatever the insurance company/PBM thinks it should cost to fill the prescription, and the patient pays a standard copay/coinsurance. If the patient has a large deductible or doesn't have insurance, this is where GoodRx et al. come in. They act as a PBM, allowing the patient to pay a price lower than the U&C while pocketing ~$5 or so of the "copay" for themselves (plus whatever data they get). Often independent pharmacies will just cut out the middle man and give you a better cash price (although this may violate their PBM contracts), but the big chains will need the coupon.
Depending on the difference between the AWP and the actual acquisition cost of the drug(s), this can be a substantial savings for cash patients or people with large deductibles.
-edit-
I guess what I mean to say here is I'm not commenting on how drug prices work. It doesn't matter. I am commenting on the fact that somebody, somewhere has to pay for the drug, regardless of the price. I want to push back on this idea that drugs are "free" in Europe or elsewhere. Sure the healthcare programs appear to be better managed, higher taxes on the wealthy or corporations (although I don't know for sure) appear to be subsidizing costs for lower and middle classes, but the drugs still aren't free in any sense of the word to the society as a whole.
Now that you've clarified, it sounds like you're arguing against the idea that drugs have no cost of development or production, which is not an idea that anyone actually holds, so I'm sorry for wasting our time. I would point that "free at the point of service" does seem to be one sense of "free".
[0] https://www.rjhealth.com/2019/07/31/drug-pricing-101-reimbur...
For a decent overview: https://www.pbs.org/newshour/economy/why-does-health-care-co...
"Just to give you one example, Duke University Hospital has 900 hospital beds and 1,300 billing clerks."
[0] https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4511963/#:~:tex....
Don’t mistake what I’ve said as support for the current system.