Do you not think aeroplane companies should make a black box that can float?
Designing these things is not as simple as you think. The black box has to survive 3600 gravities and temperatures that would melt a solid block of copper. It also has to hold sensitive electronics and work reliably even if things go terribly terribly wrong. This limits the spectrum of possible design choices somewhat. While you could pack foam around, the foam would be unlikely to stick to it through the violence of a plane crash that’s rough enough to open up the cockpit so it can float to the surface.