Formating the device doesn't remove the IMEI since its been done via EFS/NVRAM partition or CERT in case of Samsung.The websites like Priceoye etc sells repacked / activated devices, what if they also patch a device with another dead phone of same model, we usually verify the imei on PTA's website whether it's legal, but in the aforementioned case, PTA would also call it PTA Compliant device and show same model. So there're many ways to cheat, they don't allow us to open box, otherwise it can be checked by formatting device.