Why does the USA confiscate money paid for a contract?
Example#1. US-Pakistan F-16 deal of the 1980s.
According to Wikipedia:
In the 1980s, Pakistan agreed to pay $658 million for 28 F-16 fighter jets from the United States; however, the US Congress froze the deal, citing objections to Pakistan's nuclear ambitions. Under the terms of the American cancellation, the US kept both the money and the planes, leading to angry claims of theft by Pakistanis.
Example#2. US-Turkey F-35 deal
Turkey paid $1.4 billion for the purchase of 100 units of F-35s.
In the Pakistan case, Pakistanis got the money when they threatened the US government with a lawsuit. The Turkish case is probably also going on a similar path.
My question is, why does the USA confiscate/withhold the paid amount when a deal doesn't go through? Why not just return the money?