That isn't really a "transfer" as such. They need to stamp you out in your new passport, and in order to be able to do so, they put a stamp in your new passport that references your old passport, as well as a copy of your entry stamp.
What people mean when they talk about a "transfer" is that you have a permission to stay in Thailand that won't be terminated when you exit, so typically an extension with corresponding re-entry permit. While airport immigration would stamp you out and back in using your new passport, they won't transfer your extension and re-entry permit to your new passport.