Hello so I'm assuming you tried to put in another carrier as SIM? Depending if the person used it enough days on T-Mobile and is paid off they usually would have to request unlock from T-Mobile
These policies are put in place so that a person can't take advantage of some really cheap deal on a phone that requires monthly payments (often with bill credits) for a year or two, and then ditch the plan before the duration of the agreement is finished. It'd be kind of like leasing a car and then just trying to disappear with it without continuing to pay the lease.