From the CBP’s policy on electronic device searches at the border:
The border search will include an examination of only the information that is resident upon the device and accessible through the device’s operating system or through other software, tools, or applications. Officers may not intentionally use the device to access information that is solely stored remotely.
Sounds like they violated their own policy here. Amazon purchase history is NOT stored in the Amazon app, but rather fetched from the Internet.