We use them for mounting a cutoff switch or switch/recep combo to the sides of furnaces and sometimes for surface mounting a switch or recep inside a cabinet.
Why would it be "illegal" to make a portable plug box on a cord with one as long as the connector was approved for the cord?