Hello, I just went through this exact issue. When I removed the sim card the phone would boot up just fine, but with the sim card installed the phone would activation loop. In the about screen in the iPhone it said it was on the T-Mobile network, but when I installed a T-Mobile sim the phone still would activation loop.
After a number of calls to apple and T-mobile, I discovered that the phone was service locked to either Tracfone or StraightTalk. I called both those companies and found it was StraightTalk. This company would not unlock the phone under any circumstance. I offered to pay. Nope.
In the end, I got my hands on a Straight Talk sim card, and guess what? No activation loop. Fixed.
I ended up selling the phone to a guy who uses Tracfone and the sim worked fine, I suspect they are the same company.
Hope this helps.