That said the general premise is valid. The loophole comes from the fact that when you donate something, you don't have to pay capital gains on it, yet you can deduct the full value from your returns[1].
[1] "If you donate long-term appreciated assets like bonds, stocks or real estate to charity, you generally don’t have to pay capital gains, and you can take an income tax deduction for the full fair-market value." https://www.fidelitycharitable.org/guidance/charitable-tax-s...
Maybe before the cap, you could argue that the true combined marginal rate was lower than 50% since the deduction for the state income tax would offset some of the federal tax, but a $10k deduction doesn't matter much to someone who's making enough to be in the top income brackets.
Because your taxable income is $20 million less after the donation, and the top marginal tax rate (if you're rich enough to be playing this kind of game) is 37%.
The waters get a bit muddier with the capital gains tax you might be paying on the original sale, but presumably with the right accountant you're still saving some millions, whether 3 or 8 or 10.
You also have to subtract the cost of the painting, unless you consider that a sunk cost (ie. you were already planning on buying the $10M painting)