Current student here (MS3). I purchased my M3 at the beginning of medical school. However, I also worked for a while prior to starting, where I saved up enough cash for this car and maintenance/ancillary expenses.
I would say that the decision to buy an M3 depends on your financial situation as well as your priorities. I also advise against driving your M3 to or from class, work, etc. It will stand out like a sore thumb, particularly in the Northeast.
My decision to buy an M3 was not financially prudent, but it was the right decision for me. Medical school can be a dehumanizing experience, so having a hobby or an escape to which you can turn to is crucial to getting through it. Whenever I need a break, I can always take the M3 for a spin; and when I have a day off, I'll often take it to a track. My fascination with cars is a big part of who I am, so I'm very grateful to have owned this car for the past three years. I plan to either keep this car in residency or upgrade to something else.
The only suggestion I would make is to not mention or flaunt the car while in school. It will stick out like a sore thumb. The nicest car in the student parking garage will probably be something like a GTI or a 328.