Don't Medicare and Medicaid pay fixed prices? And aren't they generally below cost for the provider? So they have to "make up the difference" by charging private insurers and cash payers more?
Also, Medicare and Medicaid can't negotiate drug prices.
Medicaid varies because states have way more control and many states (especially Republican-leaning ones) have slashed their rates as part of a concerted effort to kill the program. Not that it matters - in Texas you generally can't qualify for Medicaid if you're childless or have a job. The income requirements are insanely low.
If a doctor doesn't like the rates Medic[are|aid] are paying, they're free to not accept Medic[are|aid] patients.