My understanding is there is no requirement necessitating batteries be contained in a box(es). The reg speaks only to movement of as battery.
Builder standards do not apply to preexisting boats which makes the use of boxes discretionary.
United States FEDERAL LAW 183.420 - Batteries
(a) Each installed battery must not move more than one inch in any direction when a pulling force of 90 pounds or twice the battery weight, whichever is less, is applied through the center of gravity of the battery as follows:
(1) Vertically for a duration of one minute.
(2) Horizontally and parallel to the boat’s center line for a duration of one minute fore and one minute aft.
(3) Horizontally and perpendicular to the boat’s center line for a duration of one minute to starboard and one minute to port.
The commercially available plastic battery boxes may be used to install a battery; however, it may be necessary to provide means within the battery box to prevent excess movement of the battery. The materials used for restraining battery movement within a battery box should be selected with regard to potential deterioration by the electrolyte. The battery box must be fastened in such a manner that the battery installation will comply with this section of the regulation.
Obviously, boxes properly secured offer better protection than with no box(es) but often logistics and space limitations make them problematic.