What is the purpose of a collector box on a building downspout?

The reason your sewerage pipes have a vent is that the air pressure doesn’t blow through the S/ P bends and make a foul smell inside, and to prevent the S and P vents emptying into the sewerage due to atmospheric pressure pushing into the pipes…

But the rain water pipes don’t have S and P bends, and so there is no such issue with air pressure interfering with P and S bends .
The only sensible thing a collector box does is provide a place to install a filter, to collect twigs and leaves. Some of the collector boxes seem to have overflow facility, so that if it is clogged with twigs etc, it does’t flood the roof. But if the top of the collector box is open, then it is automatically an overflow facility.

If its in the middle of a pipe, it doesn’t seem to be much use as a filter, or overflow device, since only stuff that can fit all the way through can get to that point. But it might be useful as a junction box.