The Doctor gets paid more than the cashier as a return on the investment of becoming a doctor.
People wouldn't invest all that time and money into becoming a doctor if it didn't pay off in the end.
If the investment didn't pay off because cashiers and doctors got paid the same then people just would not become doctors.
But what if there is no investment.
What if training to be a doctor is a job that you get paid for?
What if training to become anything is a job that you get paid for?
Would people still not pursue highly skilled jobs, even if the pay was the same as low skilled jobs, but the pay applied to both the years and years spent learning the skills as well as practicing in the end?