Warranty is a totally different subject. It seems you seek to link two unrelated subjects.
Warranty is a usually written time-limited guarantee of the integrity of a product and of the maker's responsibility for the repair or replacement of defective parts, mostly guarding against factory (hardware) defects.
Activation lock protects consumers by making ‘found’ or stolen iPhones unusable.
If someone want to sells their iPhone on the second hand market, then they should follow a set of procedures first: What to do before you sell, give away, or trade in your iPhone or iPad - Apple Support. Buyers should check that the iPhone isn’t activation locked, and has been reset, as shown by the ‘Hello’ screen, ready to set it up with their own Apple Account.
You need to sort this with the previous owner.