by law in many cases. Why? Well, because traditionally we have designed cities based on a "vehicular biking" model, where bikes are cars. In which case, they can take up the lane. The only safe way to do that is two abreast.
Now, I agree with you that this is bad design. We need to move away from a vehicular biking model and towards a complete streets model where every road above 20 mph has a separate/protected space for bikes.