The constitutionality of warrantless internal border checkpoints conducting searches without probable cause, within 100 miles of the U.S. border, has been upheld by the courts in the face of challenges to this practice rooted in the 4th Amendment protections against search and seizure.
Essentially, the line of reasoning is that warrantless searches at a border crossing are allowed as a way to secure U.S. borders for enforcement of customs and immigration laws (in line with universal historic practice in common law countries as of 1791 when the 4th Amendment was adopted), and that these searches don't have to be precisely on the international boundary line. Within that framework, a bright line of 100 miles from the border has been upheld as a reasonable exercise of discretion by the federal government concerning how far from the international boundary line is too far. Courts have so far not accepted any constitutionally mandated limited principle to restrain this 100 mile rule even though it pushes the boundaries of reasonableness.
The history of the rule and the U.S. Supreme Court part of the relevant case law is discussed at length here (links to the cases cited bvelow are available at this link):
In 1946, Congress quietly passed a statute giving U.S. Customs and
Border Protection the authority to stop and search all vehicles within
a “reasonable distance” from the border. Shortly thereafter, the
agency defined that distance as 100 miles from all land borders and
coastlines, thus crowning themselves kings of what is now known as the
“100-mile zone,” an area in which nearly two-thirds of the U.S.
population lives. That regulation, which effectively allows border
officers to disregard key Fourth Amendment protections within that
area, has remained in place ever since.
(The ACLU clarifies that the regulations implementing the 1946 statute adopted by Congress were adopted in 1953.)
The linked discussion of the legal history of the rule continues as follows:
In 1973, a divided 5-4 Court planted the first landmine for the
demolition of the Fourth Amendment in Almeida-Sanchez v. United
States. The case, at first blush, sounds good: In it, the Court held
that immigration officers searching a car for undocumented people
without a warrant or probable cause was unconstitutional. But in a
concurrence, Justice Lewis Powell suggested treating the areas around
the border differently from the rest of the country. Searches near the
border, he wrote, “draw a large measure of justification from the
Government’s extraordinary responsibilities and powers with respect to
the border.” Thus, he suggested that something analogous to an “area
warrant,” which judges issue to city officials to conduct housing code
inspections in residential areas, could suspend the need for
individualized probable cause within the 100-mile zone.
Powell was also sympathetic to the government’s arguments that
deportation is a civil proceeding, and that few migrants faced
criminal prosecution for crossing the border without authorization.
Because border stops were unlikely to lead to criminal prosecutions,
he wrote, border searches are not like “random area searches which are
no more than ‘fishing expeditions’ for evidence to support
prosecutions.” . . .
Just two years after Almeida-Sanchez, the justices who had dissented
from that opinion had apparently shed their reservations about
shredding the meaning of the Fourth Amendment at the border. In a
unanimous decision in United States v. Brignoni-Ponce, the Court
lowered the standard for border officers conducting “roving patrols,”
where they stop drivers on highways within the 100-mile zone to
inquire about citizenship status, to the lowest standard: reasonable
suspicion. The justices also explicitly stated that race could a
factor when determining the “reasonableness” of an officer’s
suspicion, functionally sanctioning the racial profiling practices of
border agents in the process.
Then, in 1976, the Court in United States v. Martinez-Fuente upheld
military-style checkpoints at which agents, again, randomly stop cars
to question people about their immigration status. According to the
justices, whose personal experiences passing through Border Patrol
checkpoints were presumably limited, these encounters aren’t as
intrusive as traditional law enforcement stops and thus didn’t require
“individualized suspicion” at all. In dissent, Justice William
Brennan, joined by Justice Thurgood Marshall, called the decision an
“evisceration” of Fourth Amendment protections.
The Supreme Court has even extended the leeway that it grants border
officers to run-of-the-mill cops in states like Arizona and Texas. In
2012, the Court in Arizona v. United States partially upheld SB1070,
an Arizona law that deputized local law enforcement to enforce federal
immigration law by allowing them to ask about the immigration status
of any detained person they suspect is undocumented. In doing so, the
Court enabled state law enforcement cops to engage same racial
profiling that has become routine amongst immigration officers.
Organizations like the ACLU have sought to challenge this great distance from the actual international boundary line as excessive and continue to pursue both legal challenges and legislative reforms to narrow this rule, on the theory that it is being abused to perform searches that should not come within the border checkpoint exception to the requirement of probable cause to conduct searches and seizures. But so far, these challenges have been unsuccessful. (The ACLU has also argued with somewhat more success in particular cases, that the Border Patrol overstates its authority under the case law, statues, and regulations above, in the 100 mile zone.)
On the other hand, keep in mind that internal checkpoint search authority is not granted to all law enforcement officers. It is limited to federal customs and immigration law enforcement agents, and to other federal, state, and local law enforcement agents deputized by federal law enforcement agents to carry out searches for those purposes.