Mahlambi will join Absa Premiership champions Mamelodi Sundowns after just one season with The Red Devils, with whom he signed a four-year deal in September last year to become the first South African to move to Egypt.
Sundowns have been known to be chasing the speedy winger's signature since his breakthrough 2015/16 season at Bidvest Wits, who were reluctant to sell him to another PSL team.
Pitso Mosimane also earlier confirmed that the Tshwane giant have been in discussions with Al Ahly, but said the transfer fee had been one of the main stumbling blocks during negotiations.
The Brazilians have since forked out $900 000 (R13,2-million) for the 21-year-old, according to a statement from Al Ahly.
"Mohamed Fadl, Ahly's contract manager, said he had reached an agreement with South Africa's Sundowns to transfer Phakamani Mahlambi from Al Ahly for $900,000 and get 20 percent of his resale or loan," reads a statement on the club's official website.
Al Ahly have also made it clear that Mahlambi is not to set foot back in Egypt, having included a R14,7-million fee should he join a rival Egyptian Premier League club in the future.
"The contracting manager revealed that a clause in the contract stipulates that the player is not entitled to play in Egypt," further read the statement.
"In case of violation of this clause, the parties (the player and the club) pay one million dollars. If the contract is canceled, the club pays $1 million."
The former Absa Premiership Young Player of the Season will now be hoping to rediscover his form following a turbulent stay at the eight-time CAF Champions League champions that saw him manage one goal and five assists in 15 appearances.