You're not wrong, but R+D is mostly another operating expense which lowers net income. Net income is what's taxed. Companies could spend this money on building another office or salaries for sales staff instead which would both lower net income.
Some jurisdictions may have special tax considerations for narrowly defined R+D work, but it's mostly companies spending money to try and make more money. Sometimes that pans out and other times it doesn't.
The heck is Amazon researching? I've run into CS articles / whitepapers / etc from eg. Microsoft-affiliated researchers (especially in programming language stuff), but can't remember ever seeing anything from Amazon. Probably just means I'm not reading papers from the right field / subfield
Right, it's pretty clear some of it is probably something related to AWS but I wouldn't be surprised if they did research into things like supply chain management.
I went and did some searching and found https://www.amazon.science/, and it looks like my guess of either AWS or supply chain management was pretty good since I can find articles on both on there 😀