The border search exemption is not intended to allow searching for evidence of crimes that aren't related to importing something illegally. Of course CPB isn't expected to ignore evidence of other crimes they happen to see incidentally while checking for things that are illegal to import.
Courts have been fairly tolerant of law enforcement using pretexts like that to expand their powers.