I have sold my old phones on ebay but I haven't checked for buying one. I have never been in the predicament where my phone breaks mid contract (I have Verizon so I have contract phone). If mine did break, I'm not sure what I would do.
What I'd recommend though is ask the seller for the ESN and call T-Mobile to verify it could be activated. I have had buyers email me for the ESN for that reason and I didn't have a problem giving it out, because I knew it was fine. If they don't give it out, you know there is a problem.