Rami moved from Lille in January, but returned on loan to the French side to help them win the league.
He has now completed the move permanently and said: “It’s a great day for me with many emotions. I am proud to have left Lille after such a great season.”