You can of course donate $20 mil to a charity that you can influence (a foundation of a relative or a friend’s family, say) and get that charity to buy the first painting at auction.
This way you pay cap gains on 19 million but can offset 20 million of charity donations against the gain.
You don't pay (an income or capital gains) tax when you buy something. Only when you sell it. Maybe there's some other tax, like VAT or luxury or sales that are all based on the purchase price.