Hi,
There is no need to buy Windows Server 2012 R2 activation product key.
Microsoft provides n-2 versions of Windows on their VLSC/MVLS sites. So we could activate Windows Server 2012 R2 with Windows Server 2019 product key. There is a downgrade chart below for Windows Server 2019.
But we not recommend to upgrade as you might encounter potential risk such as compatibility between driver, third party software and system or others system file corruption which will cause upgrade failure. We are more recommend to perform clean installation Windows Server 2019 and migrate server roles to it.
I found some related official article which related with installation and migration, please check if they are useful for you.
Migrating roles and features in Windows Server
Use Storage Migration Service to migrate a server
Windows Server installation and upgrade