You will not be able to do that. You can download apps again to the same userid account on different devices, but you cannot transfer those licenses to other userids.
There is no way to do this programatically - I don't think you can do that practically (except for trying to call customer support at the Play Store).