The Egyptian, 25, has signed a five-year deal and has been a prime target for manager Jurgen Klopp.
At current exchange rates, the fee is short of the club record £35m paid for Andy Carroll in 2011 but matches the sum they spent in 2016 to make Sadio Mane the most expensive African player.
Salah almost joined Liverpool from Basle in 2014 before moving to Chelsea.
Liverpool boss Jurgen Klopp said Salah has "the perfect mix of experience and potential", adding: "This is a really exciting signing for us.
"I have followed him since he emerged at Basle and he has matured into a really good player.
"His pace is incredible, he gives us more attacking threat and we are already strong in this area. I like that we will make it even more competitive."
Salah will wear the number 11 shirt, with Roberto Firmino moving to number nine.
After only six Premier League starts following his £11m move, Salah had loan spells at Fiorentina and Roma before joining the latter in a permanent move for about £15m last summer.
He was a key figure as Roma finished second in Serie A last season, scoring 15 goals in 31 league appearances.
Liverpool have already signed Chelsea's 19-year-old striker Dominic Solanke, who was top scorer as England won the Under-20 World Cup and will join on 1 July.
That fee will be decided by a tribunal after he rejected a new contract at Stamford Bridge, with the fee expected to be about £3m.
Source: BBC
This story has been reproduced from today's media. It does not necessarily represent the position of Liverpool Football Club.