I forgot you had a specific E46 thread, so moved this from the other thread since it seemed more appropriate over here.
The M54 is aluminum block in north america, make note of the year the one you are looking at was made. Some of the early ones (of which I was lucky enough to be the owner of one) had some issues with how the aluminum was cast. I used to know the technical casting details that caused that, but has been too long ago, I am sure somebody else will chime in. They don't seem to have an issue unless you have to pull the head for some reason. When you torque the head bolts, it is common to lose the threads. Some will say it happens when an engine is overheated, but my engine had never been overheated and it still did it. In my case I had three go on the second pull (still pretty low torque). I installed Time-Sert inserts in the block for all head bolts and no problem afterward. The timesert kit is about $400 but most everybody does like I did and buys the kit with inserts, uses it, buys replacement inserts and sells it again on Ebay, etc for about what you paid less the cost of the inserts which are about $25. Anybody out there that pulls the head on an M54 (at least the early ones that had the aluminum casting issue), go ahead and save yourself the time and cost of consuming a new head gasket and just timesert the threads. It's a pretty easy job. Then the fun begins on trying to retime the cams with the dual vanos. You have to get somebody with the special jig to help set those. I tried machining my own jig but just couldn't get it close enough, or didn't know what I was doing? Got help, no problems. Oh by the way, go ahead and do the vanos rebuild/update if you are at this point.