Some executives at companies with the most at stake are also big campaign donors. For example, the family of David Bonderman, a co-founder of TPG Capital, has donated $1.2 million since 2014 to the Senate Majority PAC, a campaign fund with close ties to Mr. Reid and other Senate Democrats. TPG Capital has large holdings in Caesars Entertainment and helps run a Texas-based energy company, both of which stand to benefit from the last-minute change.

“For Senator Reid, it was important, as he represents Nevada, to help the large employers in his state,” said Kristen Orthman, a spokeswoman for Mr. Reid. She noted that Caesars, MGM Resorts International and Boyd Gaming, all Nevada-based casino companies, could benefit. A spokesman for Mr. Bonderman said he had played no direct role in pushing the cause, but did not dispute that his company was involved in the discussions with congressional staff members.

Both Ms. Orthman and the spokesman for Mr. Bonderman said it would be wrong to presume his contributions to Mr. Reid had played any role in the help his companies received.

The effort to close the loophole was among many provisions in the $1.15 trillion spending plan and separate $622 billion tax plan that had special patrons. Language inserted into the federal budget over the objection of the Obama administration by Senator Thad Cochran, Republican of Mississippi, directed the Coast Guard to build a $640 million National Security Cutter in Mississippi that the Coast Guard says it does not need.

Image David Bonderman, a founding partner of TPG Capital, which has large holdings in companies that stand to benefit from the last-minute change. His family has donated $1.2 million since 2014 to the Senate Majority PAC, a campaign fund with close ties to Mr. Reid and other Senate Democrats. Credit... Michael Nagle for The New York Times

“If we are funded for it and Congress says you are going to have a ninth cutter, I guess that is how it goes,” said Chief Warrant Officer Chad Saylor, a Coast Guard spokesman. “But we are good with eight.”