Costs of attending medical school are quite high and average debt burden for graduates of medical schools is around $150K for medical school (you can add undergraduate costs to this). This can be offset by scholarships with high academic performance (compared to the rest of your classmates) incoming and while in medical school are the keys to obtaining these scholarships.
Pay in residency is dependent on the part of the country in which you do residency and increase slightly by post graduate year. PGY-1 salaries start around $39-40K with about a $1K increase per year. Moonlighting is highly dependent upon the residency program that you enter. Some residency programs strictly prohibit moonlighting and some allow limited moonlighting once you have an unrestricted license (After all three USMLE Steps are passed). You also have to pay your own malpractice insurance if you engage in moonlighting.
Also be aware that if you borrow money for medical school, the debt is accruing on the sum that you borrow while you in residency. The interest rates can vary unless you consolidate and lock in a specific rate. Congress has also been toying with eliminating the hardship deferment on student loans making it pretty difficult to live on a resident's salary and pay on your loans at the same time if you have a huge amount of debt from undergrad + medical school.
Again, residency (after 4 years of medical school) lasts from 3 to 7 years depending on the specialty with the surgical specialties being 5 to 7 years and the non-surgical specialties being 3-4 years. While you are in residency, your salary will be low especially if you count the number of hours that you will spend at the hospital (somewhere between 50 to max 80). Again, the surgical specialties tend to have the higher numbers for work hours. Most residency programs have on-call every 3-6 days where you will be in the hospital overnight. In addition, there is study and reading that every resident must undertake and keep up with in order to perform high in in-training exams and practice level (the criteria for promotion in residency).
Even getting into residency is quite dependent upon your performance in medical school and on board exams. Since you mentioned EM, you may find that this is a fairly competitive residency which demands a fairly high medical school performance (no chip shot or given). Translated, you are going to be putting in some hours studying first and second year in order to be sure that you have the medical school grades and board scores to be competitive for EM.
While salaries post residency (and board certification) are good, there are no guarantees that salaries will stay where they are especially for those folks who are not in medical school at this point. I would not look to any part of medicine as a "road to wealth and happiness". For Emergency Medicine, you have minimum of 4 years of medical school and 4 years of residency before you see any substantial income. Also keep in mind that you will not be doing much working during medical school because you need good grades to be competitive for residency.