Try to setup the iOS device for a new user. After selecting your language, country, and a Wi-Fi network, you should then be asked to enter your Apple ID and password. If you see this, all is well, and you can with good conscience buy the device.
However, if you see a screen asking for the previous owner’s Apple ID, or even a notice that the device was lost or stolen, request that the seller to enter their Apple ID information. If they can’t enter the correct information, DO NOT buy the device.