Upon commissioning, you're obligated to do five years (iirc) as a Junior Officer earning JO pay, far below what you would earn at market rate.
When you graduate from Medical School you are commission as a Captain, + professional pay. You are the highest paid intern around. Getting a military scholarship was a lot tougher than getting into medical school. My classmates that got the plum had full tuition, housing stipend, books, summer training with travel pay. After their 6 years of active duty, they had made Major or LTC. Off to the civilian world debt free.
My lab mate made far more as a military officer those 6 years than I did in my first 6 years of private practice. I am not sure how much it has changed in 35 years but from what I hear not much.