Have you ever seen the videos of the people refusing to comply with these checkpoints?
For CBP to search you under the aegis of border security, you must have recently crossed the actual US border. The law doesn't require CBP searches to occur at the actual border; for instance, there may be so many possible crossing points at e.g. the Canadian border that, logistically, search only makes sense at some chokepoint 20-30 miles from the border. But they can't search people at random. The CRS says so, and, 30 years before that, so did SCOTUS.
For CBP to search you under the aegis of border security, you must have recently crossed the actual US border. The law doesn't require CBP searches to occur at the actual border; for instance, there may be so many possible crossing points at e.g. the Canadian border that, logistically, search only makes sense at some chokepoint 20-30 miles from the border. But they can't search people at random. The CRS says so, and, 30 years before that, so did SCOTUS.