Kevin Mazur / WireImage 1 / 14
Kevin Mazur / WireImage 1 / 14

Arby's got its hat back -- but it cost them a pretty penny. The restaurant chain put up more than $40,000 to buy Pharrell Williams' now-infamous Grammys topper in a charity auction on Sunday, March 2, the day of the 2014 Oscars.

PHOTOS: The craziest style moments at the 2014 Oscars

"Thank you to whoever bought my Grammy hat on @eBay for $44,100," Williams tweeted shortly before taking the stage at L.A.'s Dolby Theatre to perform his Academy Award-nominated hit, "Happy," from "Despicable Me 2." "Your donation benefits From One Hand to AnOTHER." (From One Hand to Another is Williams' charity for at-risk youths.)

PHOTOS: What all the stars wore to the Grammys

Arby's then replied to the star's tweet, writing, "@Pharrell, you're welcome. We're HAPPY to support a great cause & get our hat back. Good luck at the #Oscars tonight!" 

The "Get Lucky" singer's interaction with the fast food sandwich company first began back in January, when he wore Vivienne Westwood's oversized "Mountain" hat to the Grammys. "Hey @Pharrell, can we have our hat back?" the chain tweeted at the time, to which he replied, "Y'all tryna start a roast beef?"

PHOTOS: The biggest show moments from the 2014 Grammys

Since then, the hat -- which retails for $180 -- has become something of a signature for Williams. He even wore a version of it when he performed at Sunday's Oscars ceremony, where he danced with the likes of Lupita Nyong'o, Meryl Streep, and Amy Adams.

MORE ON WONDERWALL:

Fashion hits and misses at the 2014 Oscars

Pharrell rocks his floppy Grammys hat at the Oscars, plus more of what's buzzing after the Academy Awards

2014 Academy Awards TwitPics