Last year I was earning 18k but my colleague who did exactly the same job as me was only on 12k! It is legal but is usually due to differences in age/experience etc (the girl earning less than me was 18 years old whereas I am ten years older with far more work experience). But it is their discretion at the end of the day.
And, like what Esoames said, your salary really isn't something that should be discussed with other colleagues. It's just one of those things that isn't 'done'. x