Rami joined Milan on-loan in January.
"I've spoken to Rami and I told him that the deadline for us to sign him had passed," Galliani told Milan Channel.
"We've already said no to Valencia in terms of signing him for the price proposed beforehand, but we are negotiating a new deal for his signing.
"I'm going to Lisbon on Friday for the Champions League final and I will meet Valencia directors in order to start new negotiations.
"Rami wants to stay, yesterday he had another great match and so we hope it all goes well."
For the big stories and the banter follow us on Twitter: @tribalfootball