Before the patent expires, the patent holder tends to do a smear campaign to inject FUD in further use of the pharmaceutical and discourages doctors from prescribing it. When the replacement medication is available it quickly supplants the old medication, even if it has more dangerous side-effects.
Medication is not a free market because the end-users are not the ones to make the decisions on which medication to purchase. It's a a decision made by doctors, who are often heavily influenced by sophisticated marketing campaigns from drug companies.
I'm fine letting the free market determine what I should pay for TVs, pajamas, corn, etc. Because I directly make the decision on what I buy. (note: corn is not sold on a free market)