Only the petition fees, which are a small portion ($1500?). The lawyers fees aren't refundable.
Some lawyers do charge up to $15,000 for H1Bs, and I've heard of people reasonably paying $8000. (Good lawyers are definitely in the $4000 range, though you can bring thing down considerably by using inhouse lawyers, which is probably what big companies do).
So if we assume that lawyers cost $2000 per petition for large companies, and that there's a 33% success rate in the lottery (it was 50% last year), we're still talking only a cost of $6000 per hire.
No, the fees are returned if the petition isn't selected.