The mileage accrual of the ticket is governed by the Marketing carrier. So, if your tickets have AA flight numbers, you'll earn based on the AA chart. If they have BA flight numbers, you'll earn based on the BA chart (or the BA partner chart).
The bigger question is whether BA would know to deny you overhead access - AA Basic Economy fares board in Group 9 and the Gate Agents are quite alert about making sure those passengers have only their under seat personal item. I'm not sure what BA would do.