I don't know off-hand if it's a federal labor law or part of my state's labor law, but terminating someone for discussing wages is actually illegal (at least in my state.) I believe it is thought to keep employers fair in their wage applications. We are not allowed to forbid employees from discussing wages with each other.
Employees are always discouraged from discussing wages especially since many factors go into wage determination and two individuals discussing their respective wages will not have all of the pieces that go with it. And as stated previously, it is tacky.
The way I talk to my employees about it is this: Very rarely will both people walk away happy from a wage discussion. If you are not happy with your salary, please talk to me. What will happen in 99+% of inter-employee wage discussions is that someone is going to walk away feeling bad: either you because you just found out you make less or the other person because they just found out they made less. Is either one of these outcomes desirable? You either feel your wages are fair and reasonable or they are not.
It is tough because in some regions, we have to pay up because of that market's employment conditions and no other reason. So, someone in a different market may find it unfair, but it is the market that we are paying more for versus the actual employee (who reaps the benefits of that market.) What they miss is that market probably also has a higher cost of living.
But even in same office scenarios, other things come into play such as the market when one person is hired versus another (a year or more can make a huge difference), what the perfect candidate was making at their last job can play into a higher wage, actual education and/or work experience, etc. Very little is apples-to-apples in wage discussion/determination.