I dont know how the profit sharing is going to work with Mattel, but allegedly a lot of the Barbie marketing was paid for by Mattel, not WB.
I also would assume a lot of the "Barbenheimer" viral shit on twitter/tiktok was mostly free once it took off, even if a marketing group seeded it, cause both of the movies will have benefited from it.
Assuming both movies hit their targets, this weekend is going to be a box office total up there with Spider-Verse and Mario Bros release weekends. Big cash for theaters.