>capture the AI cities with great works and then sell the city back to them. You'll make heaps of gold and you'll also accrue less hatred from the AIs
so selling cities back reduces warmonger penalties?
It won't reduce warmonger penalities (as far as I know) but if you take a capital you get additional hatred from that Civ as long as you hold their capital.
Selling it back to them will remove that effect.