Some of it can be silly. I go through US customs in Canada. I can then buy something on the other side of customs and take it with me to the US.
One time we were on a ground stop at YYZ. Well, we went past the point where we had to go through customs. Saw a Timmy Horton's and decided to grab a doughnut and have it with some Starbucks which is on the other side. I wasn't hiding it, but forgot about declaring it. Customs guy made me eat it. Of course they had similar doughnuts (though NOT Timmy's), at Starbucks.