I'm glad it all worked out, but at some point in the future (perhaps when updating iOS, or adding credit cards, or a number of other circumstances) you would have had to provide Apple Account credentials you do not know. If you eventually wanted to sell, trade in or otherwise transfer ownership of that iPhone, you would have had to comply with Sell, give away, or trade in your iPhone - Apple Support which also requires those credentials. If you did not comply with those instructions (which is common), then the new owner would be asking you for information you do not know, resulting in an unpleasant situation all around.
In your case, the previous owner or custodian of that iPhone was known to you and took it back. They can properly prepare it for sale, repackage it, sell it, and its next owner will probably be none the wiser. Still, it is improper to represent and sell a used item as new — even a demo unit, which that one seemed to be — and it may even be illegal in some jurisdictions.
Those are a few reasons I wrote the carrier should have known better.
The All Too Common SAD Reality of Buying a Used iPad/iPhone - Apple Community expands on some of these principles.