if you want to keep it all internal to the computer, you’ll need a midi-routing program like Soundflower (OSX) or Jack (Windows). I haven’t used either one but have heard they’ll do the trick—they can route the MIDI to another program which can grab the output as audio. Otherwise you’d need to manually grab the sound coming from the sound card somehow (not all cards support simultaneous out-in or "full duplex" though).
Not sure how much of a pain it would be to do this within Max, would need a new object for it. I’d love to have one though—be able to grab the MIDI directly in the patch and mangle it as audio. Maybe it’s simply not possible though…then again, how does Soundflower do it? Just wondering…as usual :)
You could try using Rewire, Windows and Mac, which comes with Max. For rewire you will need a host such as a Digital Audio Workstation, preferably Cubase or ProTools. You would need to create a new MIDI track to receive MIDI in from MaxMSP, then bus the output audio signal through an Auxiliary into an Audio track for recording.
As mentioned before the Jack Audio Server is a good method for internally routing signals, and is available for Mac and PC.
For rewire, see the help documentation available in Max.