I bought a house right before I started med school, and it's been a great asset. In fact, it might be the smartest thing I've done in awhile, although that's not saying much
Previous posts were right, you have to buy it and get approved before you're a student.
I rent to a couple of other students. I don't want to advertise numbers, but let's just say I don't have to take any grad plus loans which saves me tonnes.
I have shifted a substantial portion of my debt from students loans into a mortgage. This is absolutely the best part. My mortgage is locked at 4.2%, makes me smile just thinking about it
If the housing market here stays where it's at and doesn't bust, I'll have cut my total debt paid by 1/4. There is risk involved, but so far so good...
I have just redecorated my basement and plan to add a 4th bedroom/3rd bathroom over the christmas break. Renting that out will allow me to get a completely new kitchen, including an oven that doesn't require the use of a cigarette lighter. I have a lot of fun with the house, gives me something to do
If you live in a city that has been somewhat ok in the housing market, this is the way to go. So, philly, NYC are good, and detroit, tucson, etc are bad.
It helps if you have experience in the health field already and know you want to do something non-competitive, like primary care or in my case, psychiatry. Unless I do something really stupid, I should be able to match somewhere within a 30 min drive.
Good luck
EDIT: I forgot to add that I hope to have my mortgage paid off by the time I finish residency in ~7 years. Don't buy a house if you're only going to be there 4 years, that's crazy