There was a £40 million buy-out clause when Arsenal wanted to sign him. He then signed a new contract without the buy-out clause, which is why they were able to get more for him when they sold him.
Just looked it up, and there was a buy-out clause in the new contract he signed - £75 million. Liverpool sold him for £65 million.