That's not really how it works with drug prices in the US. I don't know exactly how it works behind the scenes, but from the pharmacy perspective, it's basically like this:
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.