Carton packaging, such as cardboard boxes, is light but takes up a lot of room in a container. In order to avoid transporting fresh air, it is a good idea to flatten the packaging. The smaller the packaging that is placed in the container, the more waste the container can hold. This means that more packaging can be transported in one go, and this reduces the number of transport journeys.
So in the long run, it is worth flattening the packaging as this small effort saves emissions from transport.