Thanks, but it didn't make any difference. The library has the wifi_set_macaddr() method but apparently the MAC address is hard-coded.
I could swap the NodeMCU, but it's soldered in.
Another oddity I noticed is that no matter which USB port that I plug the NodeMCU into, Windows says it is "COM4". A second NodeMCU is saying it's on COM47 even though it's on the same USB port.
I even flashed it with ESPHome and got the same MAC address of the other device. There is only six wires soldered to the NodeMCU, so I will just replace it and find a non-WiFi use for the old one.
The code from RandomNerdTutorials that you referenced works. Sort of. In my experiments, you have to reconnect WiFi after calling the wifi_set_macaddr() function. Then the chip reports a new MAC and a new DHCP IP address.
To keep my NodeMCU's straight- the one with the strange behavior, I'll call "Node A".
Node A reports it's MAC address as B4:F3:EB:1A:C4:E4 and its IP as 192.168.1.166. This is the same MAC and IP of an existing Sonoff Mini. Having the same IP and MAC was causing both devices to act screwy.
Node A also connects to the PC as COM4, NO MATTER which USB port it's plugged into.
Running the test code from RandomNerdTutorial does NOTHING to this board.
Node B, another NodeMCU, acts more normal. Different USB ports connect to the PC with different COM ports, and the wifi_set_macaddr() function does change the MAC address.
I think it's time to replace the NodeMCU (A) board.