Can i buy an Iphone off of Ebay and use it with my t-mobile plan?

I can't afford one from t mobile, so can i just purchase one offline and put my sim in it?

Don't trust eBay they sold me a dodgy graphics card it had green lines all over my screen and sold my brother a fake playstation 3 controller. Amazon are very trustworthy so I recommend you set up an account with them plus delivery is good as it takes 2 days to get your order, I trust them as been using them 2 years now. And you can get a SIM card either online or in your local shop or supermarket.

As long as it's a T-Mobile compatible phone it'll be fine, They usually put which company the phone is from.
Ebay is fine to buy from, but you might also look on Craigslist. Lots of people sell them there too, plus you can go get it today from the buyer and inspect it before you actually buy it. Only buy on Craigslist locally, Don't send money to anyone on Craigslist.

It its an unlocked att or a tmobile iphone you can