There’s a reason “cheddar” is a euphemism for money. It’s an extension of a rat race where some gorge on wheels of cheese for life while others are lured into back-snapping traps by small nuggets.

It’s that rodent-like self-survival instinct — re-interpreting “rat” as it applies to snitching — that runs throughout The Departed, director Martin Scorsese’s first modern-day crime epic in years.

Scorsese has infused some interesting ideas into the template of Infernal Affairs, a 2002 Hong Kong pop-opera thriller of which this is a remake. The chase for capitalist success, a sense of familial legacy and failure and the alternating virility and impotence of violence make this a soulful, bones-deep take on what makes up the identities of these characters.

The Departed earns a place among Scorsese’s masterpieces. For the first hour.

After that, a frightening lion’s roar of a movie disappointingly diminishes into the meek meow of a declawed kitten. Spontaneous, brash, morbidly humorous storytelling becomes a comically overwrought bloodbath with a silly new ending that overstates themes and overstays its welcome.

This foul-mouthed Fodor’s guide to Boston starts off at a semi-automatic pace, whipping back and forth between the two young policemen at its core — Billy Costigan (Leonardo DiCaprio) and Colin Sullivan (Matt Damon) — who work in different divisions.

Costigan is the lone cop to come out of a mostly slain clan of big- and small-time crooks. It’s a circumstance he can neither embrace nor escape after covert-unit superiors (Martin Sheen and the memorably mouthy Mark Wahlberg) tab him for deep undercover work.

The jangle and weight of blood money lured Sullivan as a kid when it was given to him by Irish mob boss Frank Costello (Jack Nicholson). Costello’s handout was with the expectation of dutiful work from Sullivan, who grows up to be a star detective in a massive major-crimes division.

Sullivan covertly clears the decks for Costello’s illegal activities, with tips on cop tails, raids and phone taps. What he doesn’t know is that Costigan has been gradually welcomed into Costello’s fold after a series of heists with a lowlife cousin. In time, Sullivan suspects infiltration into Costello’s crew, while Costigan sounds the alarm on an unknown police-department traitor. What ensues is a violent cat-and-rat game to see which mole will be sniffed, and snuffed, out first.

Anything is a weapon here — even a thrown toy duck with flashing lights — and the first-act violence erupts with shocking quickness. Brutality is expected in a Scorsese crime picture, and while there are no popping eyeballs a la Casino, there are surprisingly jarring moments. Scorsese also plays hell with sound effects, making cell-phone clasps feel like shivs being sharpened.

Unfolding like the first part of a great novel, William Monahan’s script strongly establishes street-savvy scrappiness of an Irish mob that’s successful, but not palatial, and led by a madman, initially played by Nicholson with passive-aggressive malevolence and wit.

Costello is not above chopping or clipping someone himself (at breakfast, he fondles a dismembered hand as if it were a bagel), and Nicholson finds the character’s deeply vile heart.

It’s a happy accident that he and DiCaprio share a feral squint to tie together their eventual father-son dynamic. DiCaprio starts the movie as if he’s wandered in from This Boy’s Life, all boyish, brushed and buzz-cut, and, one scene later, accurately looks as if he’s aged 10 years.

His searing performance provides the movie’s greatest pleasure — Costigan talking his way out of tight spots and explaining how a steady hand staves off tics and tells that could end him execution-style. (It’s confounding that Damon, who perfectly plumbed duality in The Talented Mr. Ripley, can’t match DiCaprio with a foe as formidable as his “Bah-stin” accent.)

Scorsese and Monahan know the story’s turns will shock and surprise 99 percent of the audience that hasn’t seen Infernal Affairs. It’s their greatest ally in throwing people off from a flabby finish.

It’s certainly not going to be Nicholson’s ill-advised second-act relapse into Just Jack, starting with his operatic fever dream of cocaine and hookers. His bit in a porn theater feels like an outtake from an unrated cut of Anger Management, and why Scorsese would leave in Nicholson’s jutting-teeth impersonation of a rat (complete with sniffing at DiCaprio’s neck) truly is baffling.

Ultimately, adding 50 minutes to the original film’s running time does little to punch up any of the story’s elements that are old or new. It’s made woefully clear in a guns-blazing ending that draws unintentional laughter and might make even Tony Scott shake his head in disbelief.

That winking final shot is Scorsese trying to sneak off with one last piece, but it’s also the whap of a trap that snaps this picture’s neck.