I would have zero qualms about not doing a job that i didn't feel right about or felt should never have been sold in the first place.
In your situation i would ask first and foremost, is there any way i could be held legally liable for being a part of this destructive and apparently illegal operation?
Then I would address the ethical and moral aspects.
My personal thinking on friendship and professionalism is that the two are best kept separate, sure it's great to be friends and have a professinal relationship but you can't allow friendship to cloud your professinal judgement or you stand at risk of losing your integrity.
I don't know you or your friend, so i am speculating from my own experience, but it sounds like you have already decided it is not a job you want to be a part of, you have problems with safety legal and ethical issues, but you feel guilty or manipulated by the relationship you havei.e. i don't want to let my friend down, he needs my help, he's going to set me up with accounts and equipment, and youre making excuses for yourself i.e. I need the money. whether you stay on the job or walk is up to you, either one will provide ample opportunity for self development
personally i would walk. if he's really my friend he'll get over it, and if doing a hack job is the only way to get accounts or equipment, then maybe it's not the right time.