Ref some earlier posts about Russian immigration.
The color photo which appears on their computer after scanning your passport, was scanned in Russian Embassy/Consulate where you applied for a visa and entered into the system. I don't have any proof of that, but I've noticed over a few years that photo is not the same one all the time, and not always the one you have in your passport. So the most logical explanation is they scanning visa application photos in embassies.