Cars these days know if they are not working properly so while I would be interested to know if someone fixed it or possibly swapped the motor... either that or they dumped a bunch of gear oil in the engine to quiet it down
Either way sounds like a bad situation, yeah you might get a decent car for a good price, but flood damage can take a long time to show up in the form of corrosion etc. which can have catastrophic effects on electronics/ECUs etc. of which I can't imagine how many are in a 2011 M3 that high up. Plus as others mentioned unless you plan to keep it forever and maybe turn it into a track car one day, resale of that car is going to be real tough~
I think the best advice here is to just walk away.