Why isn't it possible to download a file for status code 4XX and 5XX

I'm not aware of any specification for that topic. The behavior should be as user friendly as possible.

4XX: Why would you assume a file download if your client did something wrong? Furthermore, the client software could not differ between the case of wrong usage(e.g. invalid url) and handling a file download.

5xx: As you stated most api provide error information, but you could also not differ the case of downloading and for example an internal error providing the file.

You can use such behavior with wget and curl as you mentioned, but its not user friendly nor practical for using such an API programmatically.

The above info in mind, Chrome and firefox just try to be user friendly.

I hope I could somehow answer your question or challenge the idea behind it. :)