How is repair cost calculated?

I know that it is based on play time, but with almost the same playtime i have had completely different repair costs for the same vehicle:
for example, I spawned a F16C in GRB, I got shot down by an SPAA at the beginning. If my plane explodes right away, the cost is super low (hundreds to 2000 SL) but if I did not die and crashed finally, or I instantly J3 after my plane was severely damaged, I got max repair cost even when I only survived for under a minute. can anyone explain that is it a bug or a “feature”???

J’ing out gives you the max repair cost for some reason.

Any other costs are based off of X amount of SL per minute alive.

So, If i am hit and not dead, i have to wait until I crash to lower my repair cost?? But it seems like that crashing after being hit also gives max repair cost, I have experienced that before.