Thanks everyone
Just for clarification, the Iberia website price of the tickets is $700 cheaper than the American codeshare booked on American.
Strangely, by choosing "show flights on all airlines" on the American website, it show the American codeshare flight at $3700+, and also the Iberian flight at $3000+ (the same price it is on the Iberian website). I assumed that if I booked it through the AA website I would have a better chance of actually getting my AA miles.
Thanks again for the tips.