Can I get a used iPhone for T-mobile?

I recently learned that they're offering iPhones on the T-mobile network, but the prices are outrageous. Is there a way i could purchase a used iPhones and make it work on the T-mobile network (Legally)?

Probably not

Buy an iPhone that's used and from AT&T, then get AT&T to unlock it. Or better yet find one already unlocked. Don't get a Verizon or Sprint iPhone, because they can't really be unlocked and someone who says they have one that's unlocked is confused or a liar.