Could be a stolen Mac and the original owner activated Remote Management Profile and locked the device behind a passcode. This happened to me with an iPod Touch I bought on Facebook used it for a few years one day I tried to reset it and I got the input pin screen btw the iPod was linked to my icloud including findmy but it didn't matter. If you want to know more it's called Remote Management Profile. To fix it the previous owner must remove the MDM profile. Still don't know if this applies to you but worth readingPurchased secondhand, but five years ago — and fully wiped, factory reset and signed in on my Apple ID in the meantime. Could the previous owner still have control even after the HDD was wiped and macOS reinstalled fresh when I bought it?
Intro to mobile device management profiles
MDM lets you securely and wirelessly configure devices, whether they’re owned by the user or your organization.
support.apple.com