The truthful and literal answer to the question as you have asked it is, Yes.
The equal pay laws do not, by any stretch of the imagination, say that all individuals doing the same job must be paid the exact same amount. They say that any differences in pay cannot be based on gender (and by extension, other protected characteristics).
But that does not mean that two different people doing the same job cannot be paid differently based on length of time with the company, education, previous experience, differing skill sets, length of time in the job, family relationships (i.e. the one being paid more is the nephew of the boss) or a thousand other reasons that are not connected to protected characteristics.
Now, if you have a specific situation you would like an opinion about, you'll need to provide some details. But the situation as you have described it is not inherently illegal.