I've tried this ages ago and it works.
I think it has something to do with aluminium being far more reactive than iron. When the protective oxide layer of the aluminium foil is removed, by rubbing on the surface rust, it steals the oxygen from the iron oxide (rust). That's my take on it. (Probably wrong)