But why would that be legal? The device is owned by the individual. No judge signed any warrant search for the device. I can do what I want with my device - that is a basic right of property. Imagine if border guards seize money willy-nilly.
Because I was curious about this exact same question, I did some looking on this last night.
Case law on this seemingly requires some nexus to a border. In Almeida-Sanchez v US[0], a Mexican citizen was stopped while driving on an east-west road that was near the border but that didn't connect to the border. The marijuana that was found in his car was excluded because there was no proof he was actually crossing a border, just near it.
So I'd expect, under a functioning legal system, a warrant would be required to search your phone if you landed in JFK on a flight from Altoona.
Edit: Not on the border, btw. Just people travelling inside US. I guess it was their mistake to carry cash instead of getting a bank check or something.