Interesting politics
So, Gary Cooper plays a Confederate veteran who travels to Mexico and [SPOILER ALERT] ends up fighting with the Juaristas and giving them the gold.
Well, in history, Juarez actually had the sympathies of Lincoln and the United States (who, as soon as the Civil War was over, started running arms to the Juaristas and pressuring the French to pull out).
On the other side, the French empire (Maximilian's backers) was favorable to the Confederacy (they were getting ready to recognize them for a long time, but wouldn't do it unless the British did so first). And the Civil War was what allowed them to involve themselves in Mexico in the first place, without fear of reprisals from the Union which still took the Monroe Doctrine seriously.
In the binary, "with us or against us" world that politics often gets narrowed down to, the Confederacy and the Juaristas were on opposite sides, so I just thought it was interesting that Gary Cooper's character fights for both in the movie.
There's a plan in everything, kid. And I love it when a plan comes together!