On the river and big barges need to see things that might be floating down and if there is no moon light, need to see the shore line. The Coast Guard puts out markers on shore with reflective day boards and also flashing lights on the shore markers. They have red and greed boards and when returning from the sea, the port side will flash one time ever few seconds and the starboard will flash two times. They are placed where the channel changes from one side of the river to the other.
The river buoys are red and black and identify low water level (less than 8 ft deep for Missouri and Ohio rivers), red buoys have red reflective tape on them and the black have green reflective tape. In low light they can not be seen so putting a light on them helps.
I don't know of anyone who has ever gotten a ticket on a inland river for using a light. That said I don't know a lot of folks. Inland lakes and coastal waters yes.
For the most part, if someone is using docking lights or spot light an approaching boat may not be able to tell what direction they are coming. Note, if you see only a white light the boat is at anchor or it's moving away from you. Red and white your seeing the port side, Green and white the starboard side. Depending on how close the lights are to each other tells you if they are heading toward you or just passing