The legal grounds: The oil was shipped by a US company in violation of US law. American companies can’t do business with an organisation that the US government has designated as a terrorist organisation. Thus American authorities siezed the ship and its cargo.
That’s because even a grey market Windows key costs US$20 nowadays and that’s over ₹1,600. For comparison purposes, the largest Indian banknote is ₹500.