Re: “Are you detained by U.S. government security personnel to determine if you are free to leave the U.S.?”
They definitely check for outstanding warrants, or if you are a criminal suspect, or if you are smuggling items in, like guns (I guess drugs only move the other way).
And, you would be arrested if you try to sneak across without a Border Control check.
And, you would be arrested and put in jail by the Mexicans if they find you without proper documentation.
We don’t check people leaving America to Mexico, you can just walk across any of the border checkpoints, nobody cares. And back before the mandatory passport law we barely checked people coming back the other way, even with the passport law there’s still hardly a check, show your card/ book and go through.