"The deal for Kaka is off, we were waiting to hear from a tax man in Spain and we got his reply today. The deal is off because it is too risky," Galliani told Milan's official website.
The website continued: "After a year in Italy the so-called 'Beckham law' would no longer have applied meaning that Kaka's taxes would have risen drastically as Italian tax laws state making it virtually impossible for the rossoneri to make such an investment."
Kaka left the Rossoneri for Real Madrid in 2009 for a reported 65 million euros ($81.7m), but has endured a difficult spell in Spain, with injuries and loss of form seeing him fall down the pecking order under Jose Mourinho.
The 'Beckham Law' was introduced in Spain in 2005 as a means of attracting foreign workers into the country by considerably reducing their tax liabilities.
Milan did complete one signing on Tuesday, however, with France under-21 international striker Mbaye Niang, 17, signing from Caen on a three-year deal.
"He can play in every role up front, he will train with (coach Massimiliano) Allegri and the first team and we think he is a good player although I always prefer to wait six months before I make up my mind on new signings."
Niang had also been linked with English Premier League clubs Arsenal -- with whom he spent time on trial earlier this summer -- and Everton.
He made his Ligue 1 debut with Caen aged 16 in April, 2011, and went on to make a total of 30 top-flight appearances, scoring five goals.