In the scenario you seem to be proposing, some random border agents are not only privy to top-secret NSA projects, but also have access to the data collected by said top-secret projects, and not only that, but they know everybody who's going to drive across the border on a given day, and not only that, but they pre-screen all of those people's data to see who's planning to marry for a green card so that they can manually screen the people's devices and then pretend it was random search.
Basically, these people are not the NSA, so assuming that they have the capabilities of the NSA seems a bit far-fetched.
They don't even need to know that it's a tip-off: a computer could just spit out "selected for random phone search" and maybe "suspected immigration fraud" when that person reaches border control. The border agent needn't know how or why the selection was made, nor have access to any top-secret data. Just follow instructions.
With automated screening using access to a database of everybody's communications, I'm sure you could easily predict more than 80% of the people who cross country borders within 24-hours. For flights, that would be close to 100% accurate. With satnav, you'd probably catch a good portion of the rest who drive across.
If every government agency were dipping into the NSA's cookie jar of secrets so liberally, we'd most likely have known about all these not-so-secret programs years before Snowden ever worked there.
It's not impossible, but it's sufficiently implausible that you'd be crazy to bet on it.
I have no doubt at all that they routinely search through people's phones, laptops, tablets, and similar. And if you watch those Passport Patrol style shows where they film in immigration/customs, you can see it is common on there too.