IANAL, but it seems like it can't be done legally. Here's an example I was able to dig up:
http://www.workpermit.com/us/employee.htm#UScandFreelance
And this one makes it sound more grim if you were considering doing it while on a tourist visa:
In the eyes of CBP, the arrangement appears to be a circumvention of work authorization laws by paying a foreign individual in exchange for work, even when payment is made to a foreign account. Furthermore, in the independent contractor situation, the actual “work” often involves consulting, research or analysis that primarily takes place on U.S. soil. If the principal activity happens in the U.S. and the benefit is retained by the U.S. company, it will constitute unauthorized employment by a business visitor.
http://www.shipmangoodwin.com/files/Publication/ec95917d-826...