Amazon is an Authorized Reseller, so assuming everything goes according to plan*, it's no different from buying directly from Apple.
* Some caveats:
As a buyer, be careful whether you're buying from Amazon, or a third-party seller, new or refurbished; basic stuff.
Though it shouldn't be an issue with Apple products that would be hard to fake, like an iPad, co-mingled inventory can result in receiving fakes, or knockoffs. The "binning" practice means there is one pot for all Acme Widgets in the warehouse, not separate ones for those Amazon sells, and those 3rd party sellers sell (though my understanding is that the latter can pay extra to have their own bin). If a 3rd party sends Amazon fakes, they can get mixed up with the legitimate examples, which is common for some categories (like automotive spark plugs), resulting in an undesired lottery for the unwitting buyer.
Unlike Apple, where returns are directed into the channel for refurbishment, Amazon does resell returned products as new. If there is a barcode tracking sticker with "LPN RR" on the item, it has been rerouted inside Amazon's logistics system and is likely to be a returned item. I've received such items more than once; sometimes they've been unopened, sometimes they've obviously been opened and used, but that sticker is a telltale marker.
In short, "sold by Amazon.com" doesn't confer the level of security some may think it does in actual practice.
Apple goes to extra lengths with its product packaging when it can, such as by using folded outer wrapping with pull tabs, instead of simple shrinkwrap, but not always. iPhones, iPads, and computers have pull-tab seals. Accessories, including AirPods, may not, resulting in one less telltale.
Even if one receives a brand-new, legitimate Apple product from Amazon, it is wise to
check on the warranty coverage date with Apple; it can be wrong and not correspond with the actual purchase date. When discrepancies occur, Apple will correct them if they are provided with proof of purchase, but it is a process, and a bit of a hassle.
With Apple, dates and serial numbers are recorded at purchase time, but even their electronic records (as seen in Settings/About) can be slightly off, though from my experience, it is always to your benefit instead of against it.
I've had to submit corrections with an Amazon purchase that was a couple months short, which probably reflected when Amazon was sold, or received the inventory. They could be better at it now, but it's wise to check, just the same.
The OP brings up a very valid concern.