Can I buy an a sprint iPhone 5 from best buy and use it for T-Mobile?

^^

Of course you can. Just pay the early termination fees and then find some phone hacker in some independent cell phone store/repair place to unlock it for you

The phone has to be unlocked before you can use it on T-Mobile. Why not get an unlocked iPhone 5 instead which will work flawlessly on T-Mobile. If you need unlocked iPhone 5 cheaper than retail, mail me.

Technically yes, but it would have to be unlocked 1st. The simpler thing to do though would be to buy an unlocked one. If the intent is to use it on a GSM network buying one from a GSM network or an unlocked one would be a better route than buying one from a CDMA network.