In my experience, it all depends who you talk to. I was involuntarily rerouted from AA to Delta in January when my AA flight was cancelled. They told me that I would not receive credit but if I was close at the end of the year, they would consider the reroute to qualify for Gold/Plat status.
However, when I volunteered to move from an oversold AA flight to US Airways, I was awarded the miles after a call to AA Customer Service. (BTW, if you called but did not speak to Customer Service (which is different from the normal agent who answers), call back and try CS).
Also, this past week LGA was shut down due to a security breech (see Flight Report) and they switched us from AA to UA to ensure that we made our connection in ORD. I called AA this morning and they credited my girlfriend and myself for the re-routed flights.
I think it also depends on your status -- they probably go out of their way for a top tier member versus a non-top tier member.
--Jimk