As @mitu said. The reason behind it is that the mappings are stored under the name of the controller in the directory /opt/retropie/configs/all/retroarch/autoconfig/. Thus, if you have identical controllers, only one mapping will be stored for both of them, and if their wiring is different, their common mapping won't fit one of them.
edit: "will be" -> "are" + "doesn't" -> "won't" 😉