Champions League winners Bayern said agreement had been reached "in principle" for 27 years, who found his place in the team was taken by Mario Manduzkic Bavaria last season.
Both clubs have been in negotiations over the transfer for some time, with Bayern said last week the deal was dead as a Florentine club reportedly willing to meet the asking price of € 20 million German double winners'.
Bayern communications director Markus Horwick said contract through 2017 should be signed "within one to two weeks ahead." Gomez is expected to be around € 4 million a season.
Italian newspaper Gazzetta dello Sport claims Fiorentina transfer will cost € 15 million.
Gomez is under contract in Munich until 2016 but is known to have become frustrated at having to play second fiddle Mandzukic last season.
He wanted to arrange to move abroad to get first team football, especially with the World Cup just a year away.
Although benched for most of the campaign, he still managed 19 goals last season, including two in the final of the German Cup.
Known as "Super Mario" after the computer game character, Gomez joined Bayern in 2009 from Stuttgart for € 35 million.