Your problem is assuming the CBSA and the police operate within the same framework. They do not. And based on some of the seriously f*cked up court decisions in Canada (at all levels), I'm not surprised anyone would appeal an appeal.
As for guilt by association, when you are entering customs with someone, it's highly likely they're travelling with you. If you're doing anything illegal, they're going to get nailed as well.
If you're at a friend's house and the cops bust him at home for possession of stolen property, it's going to be pretty hard for the cops to convince a judge that you had anything to with it, especially if you didn't in the first place.
The other thing you have to remember is when you enter customs, technically you're not IN Canada yet. There are certain laws that are not in effect. For example, legally the police cannot search your phone, laptop or any other such device without either your consent or a warrant. At the border, CBSA officers can and will search those items. There's no laws in place that require your permission or a warrant.
People who think the CBSA are simply cops who work at the border and operate under the same framework as the police are sadly and seriously mistaken.
FYI, the CBSA deals with cases within Canada too and also collaborates with local police departments.
For example, the police intercept a tourist whose friend committed an immigration infraction and transfer him to the CBSA for deportation.
First off, the police should not be arresting X because Y committed an infraction.
Secondly, the CBSA should not accept the transfer of a detainee into its custody without sufficient evidence as per the balance of probabilities rule.
Given that the balance of probabilities rule is a much lower standard of proof that the presumption of innocence rule, one would think the CBSA would show enough common courtesy to respect at least that.
In my opinion, for the CBSA to lose a case based on the balance of probabilities rule can be attributed only to gross negligence in the evidence collection or corroboration process or vexatious litigation for the purpose of harassment.
Again, unlike the presumption of innocence rule whereby a person must be proved guilty beyond reasonable doubt, the balance of probabilities rule requires only that the CBSA prove that its claims are more probably true than not. Based on such a low standard of proof, there is no excuse for the CBSA to ever lose a single case. And to appeal a case it couldn't win on even such a low standard of proof is quite shameful, really.