If people are doing the same exact job then the pay should fall within the same range. I mention (range) because there are often other factors that go into making a salary offer to an employee.
Naturally the goal for most companies is to get the biggest bang for the fewest bucks. They usually have a salary comparison range to work from. However factors such as the state of the economy when one was hired or their years of experience, education/certifications, excellent job references, and awards for past achievement can cause an employer to offer one candidate a higher salary over another one.
Unfortunately a candidate's (previous salary history) will likely play a major role in determining how much is being offered. It would be unlikely for someone who earned $30k to find a job doing the same thing and be offered $50k at the new company. Most candidates are happy with a $5k- $7k raise if they could get it.
If a person was hired during a booming economy and there was a "shortage of qualified candidates" to fill positions they probably were offered a higher salary than someone who may have gotten a job in 2009 when unemployment was at 10% with a huge supply of qualified candidates available.
Lastly not everyone attempts to (negotiate) for a higher salary offer.
Some people are afraid to ask for more money just as some hate the negotiating process involved with purchasing a car or home.
Oftentimes they accept whatever the offer is and walk away "content" (until) they learn someone else got a much better deal.