Yes it is the law. If you look at all the power boats that do not have a cabin or helm superstructure that are fitted with nav lights, they are fitted with a stern all round white light on a pole, and a red/green bow light or separate red (port) and green (starboard) side lights.
The masthead lighting specs options are for sailboats. Older versions of the Safe Boating Handbook had helpful diagrams to illustrate.
Page 44 of the Handbook describes the lights.