I don't think Amazon works with them anymore for referrals? Other websites might though.
Rakuten/ebates works the same way. You go to a website, turn on the referral program, and then the plugin will send you a physical check in the mail once you hit a minimum amount (and it will be at most quarterly).
If you have customers spend $1B+ quarterly using these plugins and you get maybe 1% cut then you're getting $10m cash/yr plus all kinds of browsing data to sell analytics on.
From what I've heard they don't actually sell purchase data. I don't know for sure though.
I don't understand how referrals are worth 4b though.