Knowingly buying stolen goods is illegal because they are still not yours even if you 'bought' them.
Paying a ransom to get your own property back because it is yours is not even in the same ballpark.
Paying a ransom to get your own property back because it is yours is not even in the same ballpark.