I was surprised to have to pay a fee on a phone that was still under warranty, I came from Verizon and never had to pay for any replacement phone (if I needed one) that was still under warranty. TMO operates much differently than Verizon regarding what support they offer customers. They are half the cost though for their plans. At least in my case
I'm sorry you're confused as to why there is a processing fee for warranty exchanges. You can get more information about that in our Phone return and replacement policy FAQs. Here is a small exerpt dealing specifically with your question.
If your phone is defective and still under manufacturer warranty, you can return it directly to the manufacturer. T-Mobile can assist you by providing you with a replacement phone and submitting your phone to the manufacturer for you. This is a service that T-Mobile provides as a supplement to the manufacturer warranty that may come with your phone.
T-Mobile charges a processing fee for this service. If you would like T-Mobile to provide you with a replacement phone and to send your defective phone to the manufacturer for you, contact Customer Care to order a replacement. Please note that when you call, Customer Care will first attempt to troubleshoot your phone issues. For this reason, please make your initial call to Customer Care from a different phone or you may limit the ability to troubleshoot.
Hope this helps!