Apple has built a multi-layered theft protection system. A stolen iPhone can be locked at multiple levels simultaneously:
iCloud Lock - the device is tied to the owner's Apple ID. Without the password, it's a useless brick. →
IMEI Blacklist - IMEI is blacklisted by the carrier. The device can't connect to mobile networks. →
Chimaera - Apple's internal lock. The device won't activate. Cannot be removed. →
Beyond technical consequences, knowingly purchasing stolen property is a criminal offense. Even if you didn't know about the device's origin, police may seize it as evidence.