The 34-year-old arrived at Milan in January on a six-month deal worth 300,000 euros a month.
"This exceptional gesture shows Mario Mandzukic's professional ethics," AC Milan president Paolo Scaroni said, adding the money would go to a charity for youngsters.
Mandzukic could return for Milan already today, with star striker Zlatan Ibrahimovic suspended.