Google knows what you like and these days they will take any ad because they fired all the screening staff. My ads are usually pretty average since I opt out of everything I possibly can opt out of and I use Startpage for search, so they aren't as targeted. That's one positive thing about Google. They started as a relatively ethical company for an ad company, so there's a lot of code and best practices in place for opting out of things. That is fading, but it's way better than others. Like Facebook showing ads for things I searched for a few seconds ago on Amazon and stuff like that.
Facebook has crawlers that follow you around the web. It's not that Amazon is sharing info, it's that Facebook is tracking your browsing history (if you let it).