You need to contact the owner of the phone to ask him to remove the account and anything that's tied to the phone. If you purchase this through eBay, open a case and explain the situation and I guarantee they will give you your money back.
Secondly, when you factory reset a phone, everything is deleted including accounts, passwords, settings. I recommend performing another factory reset, but this time, make sure to delete the contents of the internal storage as well, because certain Settings files might be there affecting the same apps you try to install.