#1 is ambiguous. It literally means each individual sock costs two dollars. However, in the United States, socks are always sold in pairs, so the listener would probably assume it means two dollars for a pair. In real life, the listener would probably ask "Do you mean two dollars for a pair?"
In #2, "each" is not right. I would say "socks are two dollars per pair." You could also say "socks are two dollars for each pair."