Hello and thank you for the opportunity to assist you. My name is ***** ***** I will do my very best to answer your legal questions.
It looks like the website where you got that information from pertains to NJ and not MA. However, the bot***** *****ne is that if the apartment was illegal, then the landlord had no right to accept rent in return for using the apartment. Accordingly, your girl would be entitled to a return of all rent paid during the entire time that the apartment was illegal. Of course, she'd also be entitled to the return of any security deposit that she may have given. If the landlord refuses to pay, then she can sue the landlord.
Unfortunately, suing for emotional distress would not likely be successful. Your girl would have to prove that the landlord's conduct was extreme and outrageous (i.e., heinous and utterly intolerable in a civilized society), and that she suffered severe emotional distress as a result (i.e., emotional distress accompanied by physical symptoms). Based upon these facts, it seems unlikely that the facts in this case would give rise to that type of claim.
Does that answer your question? Please let me know if you need clarification, as I am happy to continue helping you until you are satisfied. Also, please remember to provide a positive rating via the stars (and note that your positive rating is the only way that I'll get credit for helping you, so it is much appreciated!). Thank you. :)