It is possible to restore the Device ID with Titanium Backup (root required). If you have this app installed before you wipe, you can make backups of your apps and data, as well as the Device ID.
When you factory reset your device or install a new Rom, you get a new Device ID. Install Titanium Backup and make sure it has access to its backups (usually the external SD card; internal memory will usually get wiped on a factory reset).
It will automatically detect that the Device ID has changed and ask if you want to restore it.
There may be other apps that can do this. The main requirement is that you save the previous Device ID before wiping. If you don't do that, you can't reset the new Device ID to the old one.