As noted, on a domestic AA flight, this would not be possible.
When I flew my son back and forth overseas this past summer, I did use my AA # to book his British Airways flight. I did receive AA miles for the booking. I would have never thought to do so intentionally, but it did play out that way.
Could I guarantee this outcome each time? no idea.