It's not your phone. Nothing you can do.
If this happened to me I would do an IMEI to check the phone's status. From what I have gathered here if it's locked only your "friend", under the right conditions, can unlock the phone. If you know the address of your "friend" return it back to him/her. T-Mobile won't unlock it.
It sounds like your friend stopped paying for the phone or the service. If the phone was being paid for on an installment plan, he may have stopped paying for the phone when he got upset and the phone would be blocked from being used. You are going to need to work with your friend on this one to get the phone in working order again cause it sounds like he/she is the one who is responsible for paying for it.