The RP cost is logical, but the problem is that for some unknown reasons the devs like to keep everything they can hidden. This is very much the opposite to say, Panzer Corps, which even has the excellent detailed after combat report. But that's the way it is and it hasn't prevented me from buying all the DLCs and the forthcoming ones also.
So, what follows is how I see it from my experience:
Replacement cost = Price x Amount x Experience x Quality x Discount
Price is the purchase price of the unit.
Amount is the amount of strength points you get. It can be something between 0.51 - 5.00 pts. The game uses fractions, so for instance what looks like being exactly 2, may actually be only 1.51. This is why two apparently identical units may have a different repair cost. For instance let's assume unit A has an actual strength of 5.6 and unit B 6.4. The game shows both having a strength of 6. Now if you use the big repair, unit A gains +4.4 and unit B +3.6 strength points., but it
looks like both got exactly 4 points at different cost for no reason.
Experience is the figure you see if you hover the mouse over the stars (0 - 10,000). Two thousand points equals to one star, but the cost formula uses the exact value.
Quality is the quality of the replacements used (regular/elite). Elite replacements do not lower the experience of the unit, but are much more expensive.
Discount is something you can get from a specialisation like Pilot Rotation.
Note that the formula above
is not the real formula in the game, but a method to show the variables involved. It is all very logical, but shrouded in a veil of mystery.

Note also that I used only two decimals to keep the explanation simple, but the game likely uses more.
I might have forgotten something, but that's it for now.