Public policy. Have public education and graduate X number of doctors every year no matter what.
Free market doesn’t work well for essential services. Lobbying will artificially restrict supply to make more money at everyone else’s detriment. Demand for health is unbounded and any patient will value life over capital, so without forcing oversupply it will be exploitative.