PARIS — Boxes at the Paris Opera. Prime seats at the French Open. Luxury hunting retreats in Normandy. The financial giant UBS spared no expense in enticing wealthy French people to open bank accounts in Switzerland.

The lavish spending caught up with UBS on Wednesday, when French judges ordered it to pay a record 3.7 billion euro fine, about $4.2 billion, for carrying out what prosecutors said was a long-running scheme to help French clients hide huge sums of money from the authorities.

The penalty, the largest in French history, included €800 million to be paid to the government, which said it had lost revenue as a result of UBS’s helping French citizens evade taxes from 2004 to 2012.

UBS said in a statement that it “strongly disagrees with the verdict” and that it planned to appeal. “The bank has consistently contested any criminal wrongdoing,” the statement said, adding that the judgment was “not supported by any concrete evidence.”