Pep Guardiola's goal-laden start to his Bayern tenure continued as the Bundesliga champions followed up Saturday’s 6-0 win over Grossapach with another routine victory.
Lahm broke the deadlock after 20 minutes when Ribery beat the offside trap before cutting back and crossing for the Germany international defender to steer the ball home from close range after ghosting in unmarked at the far post.
Ribery went from provider to scorer just four minutes later. Neat footwork from Claudio Pizarro allowed him to escape two defenders and work the ball to Ribery on the edge of the penalty area and his low strike beat goalkeeper Johannes Brinkies.
Bayern had to wait until the 75th minute to add a third, but when it came it was an emphatic finish from Muller.
Mandzukic’s downward header directed Xherdan Shaqiri’s chipped cross to Muller and he pivoted on the penalty spot to blast into the top-left corner.
Mandzukic made it four with two minutes remaining when he reacted quickly to pounce on a parried save that denied Pierre Hojbjerg following a free-kick routine with Arjen Robben.
The proceeds from Sunday's friendly, thought to be €1million, will go to help improve Rostock's financial situation as the knock-on effects of suffering relegation from the second division of German football in the 2011-12 season continue.