Visa can be transferred. But, Green Card process has to be restarted from the square one; that is +10k for attorney.
That's not fully true AFAIK. The green card (GC) is a 3-step process - PERM, I-140 and GC itself.
If you already have your I-140, unless your previous employer cancels your I-140 (which cost them a few thousand dollars), your new employer can just start over the third step of the process. This is not optimal, sure, but it is not square one either.
So if you can get as far as the I-140/I-485 filing, you should be good to go, though IANAL (and you should retain your own to guide you through this process).