An M3 is an expensive car to maintain. OP, if you buy a low mileage E46M (which you should), that car will likely have some similar repair requirements I've experienced. Here is my list.
1. Every 7500 miles 7 qts (1 spare qt) of 10w-60 Castrol TWS + Oil Filter; Parts cost about $120.00; 60K/7.5K = 8 Changes @ $120.00 = $960.00
2. Every 40,000 miles Castrol LT2 Gear Oil & Rear Diff "3 Pack" of Castrol XJ blah blah blah diff fluid; Parts cost about $120.00;
3. Replace all junky Bremi pencil Coils with Bosch Coils & Use Denso Iridium spark plugs; Parts cst about $300.00
4. 50,000 Miles, RTAB Failure Pass. Side: Parts & Labor about $400 for both sides (Incl Vorshlag Limiters)
4. 60,000 Miles, Valve Adjustment; Parts & Labor Cost $500.00 (+Rental Car for a few days)
5. 80,000 Miles, Broken Vanos Hub, Exh Cam to Drive Vanos Pump: Parts & Labor $2,000.00 (+Rental Car for 3 or 4 days)
6. 100,000 Miles, Replace entire cooling System: Parts & Labor (+Rental Car for a week) $2,500.00
7. 105,000 Miles, New Fuel Pump & Filter; Parts & Labor $800.00
8. Tires: I don't believe in buying "2nd or 3rd tier" tires, so only Michelin & Continental @ 4 sets around $5,000.00+ (Incl mount'g & balanc'g)
So above, this is what I've spent so far on my 2005 M3 just for the large ticket items. I've left off minor costs. I knew it was going to be expensive to own an M3, but I didn't know it was going to cost me somewhere around $10,000 in maintenance since I've owned the car. I've also modded my car quite heavily so those costs are not even included.
As with any expensive GT (Grand Touring) class car, it is my opinion that one should buy the newest and least mileage car one can afford, which is what Bruce Anderson of "Porsche Excellence" fame always emphasizes. As noted above by others, a nice M3 that hasn't been "rode hard and put away wet" should cost around $25,000 and have low mileage say in the 30K-ish miles range. Now, my experience won't mean your costs will be the same because we all make different decisions on how well a car should be maintained. I'm fairly anal about my maintenance but some others are not, so there will be a cost variance.
Now, if someone were to tell me years ago that I'd spend this kind of money on a car, I wouldn't have believed it. I, like many, wanted an M3 so I got one. In hindsight, would I still buy this car and still spend all this money, nope. I'd get something else and use the money for investment or some other useful endeavor. For me, what's done is done though. OP, I hope this educates you and enlightens you. Good luck on your choice and proceed wisely.