Mahrez was City's record signing when he joined from Leicester City in 2018 and Jack Grealish is reportedly close to taking that distinction for himself, with the Premier League champion rumoured to have tabled an offer worth £100 million ($187.4 million) for the Aston Villa and England star.
Some observers have predicted Grealish could experience the sort of slow start to life under Pep Guardiola that Mahrez endured three years ago, but the Algeria winger was in full flight against City's overmatched Championship opponent.
Mahrez charged down the right flank to retrieve Ruben Dias's raking ball and crossed for Samuel Edozie to tap in a 23rd-minute opener – the teenage forward having also netted during the midweek win over Preston North End.
Another youth team player, Ben Knight, doubled the advantage after Mahrez released an underlapping Joao Cancelo and the right-winger got in on the act himself in the 34th minute when he clipped home a wonderful half-volley from Benjamin Mendy's centre.
It could have been worse for Barnsley before half-time when Cole Palmer wriggled away from Cauley Woodrow to win a penalty, although Bradley Collins guessed correctly to save the young playmaker's spot-kick.
Mahrez was inevitably involved again when Nathan Ake made it 4-0 midway through the second-half, while Ilkay Gundogan and Oleksandr Zinchenko came off the bench to enjoy their first action of pre-season after returning from UEFA Euro 2020 duty.
City will face Blackpool on Wednesday (AEST) in a final friendly before next weekend's Community Shield meeting with Leicester City at Wembley.