is it legal to pay different wages for same job
No, legal has nothing to do with it. It isn't illegal to play favorites.
It is illegal to discriminate because of race, gender, age; against the protected classes.
An employer can pay his brother $200 an hour to drive a truck, and you $10 an hour to do the same job.
That same employer can assign his brother a new truck every year, and you get a five year old truck.
That employer can hire his sister as a driver, pay her $250 an hour, and assign her to drive him around in a new stretch limo.
The employer can pay her girlfriend or boyfriend $1,000 an hour to wear sexy nightwear and prance across the desk in her office to the tune of TAKE IT ALL OFF, or SHOW ME YOUR HONEY, LITTLE LOVE BEE. LOL
All of that and more, all legit, 2 LEGIT 2 QUIT.
Favoritism is okay, discrimination is illegal.