Even with the device's passcode though, AFAIK you can't just re-assign the phone to your own AppleID without the previous owner AppleID releasing it.
EDIT: ...only if the previous user opted in to Activation Lock[1]
EDIT: ...only if the previous user opted in to Activation Lock[1]