Some mobile platforms do support this functionality at the platform-level (e.g. I've tested this with the Qualcomm APQ8064 where I had configured the hardware codec route accordingly, and it works). But Android doesn't have an API that let's you use this as an app developer, so on a non-rooted phone there's not really anything you can do.
Why there's no API for it - or whether there will be one in coming versions of Android - I don't know. There might be legal issues in some markets, or it might just be because it's considered as a semi-obscure feature that they don't see a great demand for and which is supported only by a relatively small number of platforms.
Another thing to consider is, do you really want to have music playing in the background during a call?
The audio is going to be 8 kHz mono (or 16 kHz mono if you're in a wideband call), and it's going to be AMR-encoded along with the rest of the speech signal (AMR is a low-bitrate codec designed for encoding speech). In other words, any music you play over the voice call uplink is going to sound really, really bad.
UPDATE: For APQ8064-based phones where you have root access, the procedure would be something like this (I don't remember the exact syntax off the top of my head):
audioManager.setParameters("incall_music_enabled=true");
// Execute the following using e.g. Runtime.exec()
amix 'SLIMBUS_4_RX Audio Mixer MultiMedia2' 1
aplay -Dhw:0,1 mono_8khz_data.pcm
// When you want to stop music playback, stop the aplay process, and then do
audioManager.setParameters("incall_music_enabled=false");