WASHINGTON — Two huge oil companies are entitled to recover about $158 million from the federal government for an offshore oil-and-gas deal that never materialized, the Supreme Court ruled Monday.

The justices voted 8-1 in a breach-of-contract lawsuit against the government by Mobil and Marathon stemming from their ill-fated attempt to explore for oil and gas off North Carolina's Outer Banks.