Hey Captains,
This is a great topic and let me see if I can help a little bit!
As captains have said before some ships within the line have more expensive modules than others but you have to take into account the entire line XP cost. If you take a look at the North Carolina for example, the hull is more expensive than the Richelieu's hull as you said but the xp needed to get the Iowa is less than what you need for the Alsace.
Some rough numbers and excuse if my match is off hehe.
IJN total line cost with all modules is 996,800.
USN total line cost with all modules is 1,011,700.
French total line cost with all modules is 997,300.
So there is a difference of around 14k xp total. In the end there is not that much of a difference in the overall cost of the line.
You have to also remember there were hulls removed from some of the ships.
I hope this helps and now you can tell me my math is wrong =).