Found it (Federal Law and upheld by the Supreme Court).
The legal ability of the Border Patrol to stop traffic, to question persons, and to search traffic is uncontested. The Supreme Court decision is the last word.
http://www.aliciapatterson.org/APF1804/Davidson/Davidson.html
http://www.ptleader.com/main.asp?SectionID=4&SubSectionID=4&ArticleID=21651&TM=80391.33
http://www.ccis-ucsd.org/news/Art.%2048.pdf
http://www.gao.gov/products/GAO-05-435
INA 287 (a) (3) within a reasonable distance from any external boundary of the United States, to board and search for aliens any vessel within the territorial waters of the United States and any railway car, aircraft, conveyance, or VEHICLE... and within a distance of twenty-five miles from any such external boundary to have access to private lands, but not dwellings for the purpose of patrolling the border to prevent the illegal entry of aliens into the United States;
They don’t seriously enforce laws against illegal immigration, so this is the only part they care about:
“(5) to make arrests-
(A) for any offense against the United States, if the offense is committed in the officer’s or employee’s presence, or
(B) for any felony cognizable under the laws of the United States, if the officer or employee has reasonable grounds to believe that the person to be arrested has committed or is committing such a felony, if the officer or employee is performing duties relating to the enforcement of the immigration laws at the time of the arrest and if there is a likelihood of the person escaping before a warrant can be obtained for his arrest.”
Just a “legal” way to stop and search anyone without probable cause.