Medicare/Medicaid are specifically not allowed to bargain on drug prices, though. They are a monopsony for hospital/doctor services, with full pricing power, for the old and poor, but pay market prices for drugs by law.
More accurately, Medicare is not allowed to negotiate for drug prices, however, the don't pay more than the average selling price for a drug (ASP).
Medicaid is certainly allowed to negotiate over drug prices. Medicaid gets an automatic 23% off the drug price and if the states can get an even bigger discount, they often get to keep it.