Non-resident aliens do not have to pay capital gains tax for stocks, but they have to pay a 30% tax on cash dividends (source). Can they avoid this tax by selling the stock before the ex-dividend date and buying it back on the ex-dividend date? Since the price of the stock will fall by approximately the amount of the cash dividend, they would have produced a homemade dividend when they repurchase the stock at a lower price on the ex-dividend date. Is this method allowed?
There is one problem I can see: there is no guarantee that they would be able to repurchase the stock at a lower price on the ex-dividend date. How can they get around this problem? Can they use options for this?
(Assume that the non-resident alien lives in a tax-free jurisdiction that has no applicable tax treaties with the US.)