Nowadays it’s hard to surprise with a tale of corruption and foolishness in American government, but even in today’s cynical climate the story of Efraim Diveroli and David Packouz’s chicanery remains particularly revolting. In 2006-2007, the twentysomething high-school friends, operating through Diveroli’s Miami-based start-up company, take advantage of Washington’s mania for outsourcing “war on terror” business to win a lucrative defense contract to supply ammunition to the Afghan army and then provided cut-rate bullets obtained in Eastern Europe to increase their profit margins and allow them to live the high life. The end came only when they were caught delivering repacked ammunition manufactured in China, which violated a U.S. embargo on all military equipment produced in that country.

The entire unsavory tale was first recounted in typically flippant style by Guy Lawson in a Rolling Stone article of 2011, and then more fully in his 2015 book “Arms and the Dudes.” Writer-director Todd Phillips, of the “Hangover” franchise as well as such cinematic gems as “Frat House,” “Road Trip,” “Old School,” “Starsky and Hutch,” and “Due Date,” has now adapted it for the screen as an absurdist dramedy. “War Dogs” represents a very real step up the cinematic ladder for him, even if in the end it doesn’t manage to become the wild, antic ride it so desperately wants to be.

Part of the problem is that it’s constructed as a sort of apologia for Packouz (Miles Teller), who in this telling is depicted as more as a manipulated naïf than an unscrupulous criminal. He’s a hardworking Miami masseur with a beautiful girlfriend (Ana de Armas) and a child on the way, as well as hopeless dreams of getting rich by selling high-quality bed sheets to nursing homes. As his scheme crumbles, he reconnects with Diveroli (Jonah Hill), a school pal who’d gone off to L.A. to work with his uncle in the arms business but has returned after a falling-out with his family, intent on starting his own operation back in Florida. It isn’t long before he invites David—the only person he trusts, he says, to partner up with him.

As played by Hill with a high-pitched manic laugh, Efraim is a con-man who turns on a dime from oily self-confidence to angry tirades against anybody who peeves him. A consummate role player who can be, as David says, whatever the person he’s trying to impress wants him to be at any moment, Efraim secures financial backing from a dry-cleaning mogul (Kevin Pollak) to open an office arbitrarily called AEY, which initially specializes in using an Internet site to bid on tiny government procurement contracts—a process the Bush Administration had adopted to deflect charges of cronyism for its pro-forma awarding of lucrative deals to companies like Halliburton. Diveroli instructs Packouz in the ways of searching for the right kinds of projects—the “crumbs” that big firms won’t touch—that can establish their fly-by-the-seat-of-their-pants as an ostensibly reputable concern.

Packouz explains the operation in the most benign terms to his antiwar girlfriend, but is getting sucked into Efraim’s habit of nefarious bravado. And it’s he who happens upon a contract that will take AEY into the big time—to supply a US outfit in Iraq with Barettas. Unfortunately, at the last moment they have to route the shipment into Jordan and then go to the Middle East in person to get the guns out of customs and smuggle them through the “Triangle of Death” in Anbar province. This tense, rambunctious episode, in which Efraim plays the ugliest possible American, is easily the best in the film, the place where Phillips pulls off the over-the-top tone he strains for elsewhere.

Unfortunately, what follows isn’t the high point of the film despite being the apogee of the Diveroli-Packouz operation, though also the one that leads to their downfall. It involves a Pentagon contract to supply ammunition for the AK-47s earmarked for the Afghan army, which links the guys up with a notorious arms dealer (Bradley Cooper) with ties to Albania—a place where the needed bullets can be purchased at low cost. Unfortunately, Diveroli and Packouz learn too late that the ammo was made in China, and to save the deal they decide to repackage it—a scheme that eventually leads to their arrest. It also destroys what seemed like a friendship, though from Packouz’s perspective Diveroli’s actions have proven that it was never truly that.

Oddly, while “War Dogs” shares the sensibility and style of a picture like “American Hustle” (while never reaching its heights), the film it most resembles thematically is “The Third Man,” though it lacks the moral gravity of Carol Reed’s classic (as well as offering more than a glimpse of the Harry Lime surrogate). Thanks to Hill’s intensity, it succeeds in large measure as a darkly comic portrait of a bottom-feeding war profiteer, but the emphasis on sad-sack Packouz, played blandly by Teller, softens what might have been a truly sharp satire of the American dream gone terribly to seed. Technically, however, it’s a polished product, employing Bill Brzeski’s alternately gritty and slick production design and Lawrence Sher’s quietly forbidding camerawork to good effect

“War Dogs” is a bit of a mongrel, inviting us to revel in some outrageous bad-boy shenanigans before sagely concluding how wrong they were, but Hill brings enough sinister energy to the proceedings to keep it interesting.