Are there any legal reasons for that?
Some are for legal reasons - some video/audio formats require further license agreements or don't quite fit under the Ubuntu license schema. You can read more about this on the Ubuntu Wiki: Restricted Formats page.
I know that Ubuntu Studio comes with a lot of these codecs and "drivers" already installed. However for an average desktop user it's a lot of overkill as it's designed for multimedia market.