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...