Can i buy an iphone on amazon and bring it to tmoblile?

Http://www.amazon.com/Apple-iPhone-8GB-Black-AT/dp/B0074R0TOE/

I know it says AT&T but there are none that say T mobile. So will it work?

I wouldn't risk it, try and find one that isn't set to a company yet, look on ebay and stuff too, or go into T mobile and ask, iPhone 4's at 8GB will be cheap-ish, and it's worth to extra money to know you will actually be able to use it!

As both AT&T and T-Mobile are using GSM technology, you should be able to get the iPhone, have it unlocked, and then use it on t-mobile once you contact t-mobile and get a new SIM chip for it.

Now if you were going to Verizon, then an AT&T phone would be a problem as now you would be talking about crossing technologies from GSM to CDMA.

Well there are two things to try first if you buy it try and put your tmobile sim in it and see if it works it will work if it does not ask for a unlock code.second if that happeneds just get your phone unlocked here: https://www.unlockhandset.com/
or at the flee market then you will be able to use it with tmobile

It would have to be unlocked in order for it to work on T-Mobile