I walked out the door with a box of Lantus pens having spent 80€. That would have cost me about $600 in the US at the time, if they’d even dispense to me without a prescription.
There are discount cards that work with insurance, too. Like a drug with a $10 copay might have a discount card that fully covers the copay. You just have to do a little research before going to the pharmacy.
Don't forget that doctors are completely disconnected with cost. They don't even know their own rates that will be charged to the patient in many cases, let alone what the cost of drugs are, and what portion of that the patient will end up paying.
So on the patient side, the pharmacy will compete for patients with convenience, while the insurer will try to steer the patient to approved generic drugs and manufacturers with negotiated deals, while the drug companies are trying to steer the patient to the most expensive name brand drugs. Oh yeah, and then there are the unlucky minority that don't have insurance or have insurance that won't cover the drug they need, and they get a coupon.
It is SUPER fucked.
The answer is that there are at least four parties in any pharmacy transaction (Dr., Pharmacy, patient, drug maker, and sometimes insurer) that all have different incentives. Some that overlap, and some that are opposed.
I can think of a lot better things to spend $14k a year on.