I have dev boards from Nordic which do this. Nrf52840 usb dongle, about $10-15 iirc, the code is on the underside near the exposed USB pads. They use datamatrix on the soldermask, but the two boards I have from the same batch have different barcodes, so I assume that they add them later with a laser engraver. Based on the sharpness of the edges and fine detail, it’s not a CO2 but likely YAG, fiber or UV laser.
You need to be careful that the barcode is not inverted (dark where is should be white, etc) as many off the shelf scanners cannot read the inverted ones.