I'm not sure how true this is, nor how reasonable it sounds since I don't know what the inside of an Amazon delivery truck looks like, but it sounds like the sort of thing that could be true in some circumstances.
And if I'm wrong about my source, the other person who I could possibly have heard it from is my friend who works at Amazon. As a sysadmin managing a small part of AWS, not in delivery — but he would also be in a position to know.
Either way, I believe that's correct, that the oversized boxes are that size because they were being used as filler in the truck. The algorithm calculates the planned truck packing based on what items are going to be transported together (going to the same city therefore in the same truck), then picks out the box size that each item should go into. And most of them will be correctly sized, but in each row either zero or one (or possibly more in some cases) will be oversized.