I mean it really depends where you go to school, but a lot of people come out ahead. Economically it works out like this. The stipend counts as income, and a lot of people use it to buy a house, so the economics become drastically different.
Let's say you got a stipend of 28k and you went to... say... Ohio State. Median home value in Columbus is $155k for a single family home. If you got an interest only loan, got the first time home buyer's grant for Ohio ($3100) and covered your closing costs and 1% of the value, you'd have mortgage payments of $997. You're paying approximately $10k in interest a year, which is deductible as an expense. You will pay $1550 a year in property tax and homeowner's insurance will be around the same, but that expense is also tax deductible. So running the numbers, with that, you'll pay about $2500 in taxes (just income, no FICA) for state and federal, meaning your take home is $25500, $13000 of it goes towards housing related costs, leaving you $12500, which is significantly more than a med student would have in their COA after paying for housing. You could probably save $5k a year in this scenario, which they invest at 5% interest. We'll compare this to someone going to OSU OOS (first year OOS, next 3 IS) totaling $245396. $8500 each year, for a total of $34000 will be subsidized, if the student takes out unsub stafford loans and grad plus for the rest at an average of 6.9% fixed which accrues immediately. Let's say they stay in Columbus for res/fellowship, get paid $50,000 as a resident and $60,000 as a fellowship and buy a house for the same cost as person 1 and put every single dollar they can afford after their living expenses towards repayment (which is very unrealistic), and let's assume they do an IM residency and GI fellowship for a total of 6 years in training. With income of $50000, they can repay $21000 a year during residency and $30250 a year during fellowship, leaving them a total of $205930 in the hole after residency and fellowship, with home equity of about $40,000 after 6 years. Median salary for a gastroenterologist is $315,000, let's say our person starts as an associate at $250,000 for two years, then moves up to $300,000 in year 3. By my calculations, this person would be able to pay off all their loans by year 3 and have saved $145,000. This is the BEST case scenario, assuming they spend every single dollar over what they need to live and put it towards their mortgage. With the increase in home equity (2% appreciation) and what they earn in home equity, they'd have about $55000 in home equity at this point as well.
Meanwhile taking a look at our MD/PhD friend, if they did the same track, they'd have about $50,000 saved by the end of med school, with about $60,000 in home equity. During residency and fellowship, since they have no debt repayment, they can save the $21000 and $30250 instead of paying back the loan, leaving them with $248473 in savings by the end of residency, at the same time point as the person working three years. They would also have home equity of approximately $90000 at this point, leaving them about $130,000 ahead of the person doing MD only.
Keep in mind that these are 1) the best case scenarios 2) pretty quick/dirty calculations, the math is right but there's a lot of assumptions I didn't check into 3) the MD person still repays all their loans by year 3, which is pretty awesome in my book. 4) this assumes repayment. If they made the minimum payments on their debt service during residency and fellowship they'd owe about $375,000 by the end of fellowship, meaning it would take just over 3 years to pay it back assuming they did so super aggressively after they finished fellowship.