Two young Florida men become improbable arms merchants in “War Dogs” (Warner Bros.), a fact-based movie that hovers uneasily between raucous comedy and serious exposé.

At issue is the respective blameworthiness of the duo, the pitfalls of the Pentagon’s procurement system and the moral legitimacy of the American-led wars in Iraq and Afghanistan.

In 2005, Miami native and college dropout David Packouz (Miles Teller) is living with his girlfriend Iz (Ana de Armas) and working as a licensed massage therapist. Seeking a better career, he tries selling bed linens to retirement homes with no success. Then he runs into Efraim Diveroli (Jonah Hill), his childhood pal from yeshiva school whom he hasn’t seen for years.

A colorfully outsized, alternately obnoxious and charming figure, Efraim is a born hustler who has recently returned to the Sunshine State after a stint in Los Angeles hawking guns and ammo on the Internet. His latest scheme entails bidding on Defense Department contracts through an initiative designed to let small businesses get a slice of the military spending pie.

He invites David to join his one-man operation, AEY Inc. They proceed to get rich by engaging in fraud and otherwise circumventing laws and regulations pertaining to the poorly administered program. To close their first major deal, they drive a truckload of guns from Amman, Jordan, to Bagdad’s Green Zone in Iraq.

Their success, and the sensitive nature of their business, does nothing to curtail their shared pot-smoking habit or Efraim’s appetite for cocaine and nightclubs. Iz, who gets pregnant and gives birth to a baby girl, is opposed to the war and to guns in general, so David lies to her about the nature of their work. Eventually, Efraim and David join forces with a fugitive arms dealer named Henry Girard (Bradley Cooper), which enables them to bid on a $300 million contract to supply munitions to Afghanistan. The project requires spending considerable time in Albania and does not end well.

Director Todd Phillips, known for “The Hangover” and other comedies featuring crude male bonding, wrote the screenplay along with Stephen Chin and Jason Smilovic. Basing it on a 2011 article published in Rolling Stone magazine, they take considerable creative license, not least in their attempt to imbue the story with antic humor via Efraim, who has much in common with Donnie Azoff, the character Hill played in “The Wolf of Wall Street.”

Hill’s talents as a comedic and dramatic actor are evident. But the performance feels derivative.

Phillips and his co-writers exhibit their lack of artistic resources not only by resorting to an abundance of cursing in the dialogue, but by their reliance on screen titles, voice-over narration and the blasting of middling rock ‘n’ roll songs to punctuate key moments.

The decision to make David the hero of the story — he’s far less culpable and morally corrupt than Efraim — is understandable and may even be justified by the real-life facts. But it hobbles the movie from an entertainment perspective since Teller is an amiable yet rather bland actor. Moreover, painting David as a victim of Efraim’s machinations lets him off the hook far too easily.

While offering limited insights into what enabled its scenario, “War Dogs” is content to blame the system as opposed to the choices individuals made. Phillips and company aren’t blind to the ethical consequences of their story. Yet they downplay the fact that both men were crooks and scammers, in addition to being monumentally stupid.

Declining to pass judgment is one thing. Depicting the duo as underdogs or outsiders with a penchant for stirring up trouble and defying the odds is a cop-out. So, too, is the film’s abrupt, cliffhanger ending, which refuses to reveal what David has learned, what he truly values and what he’s got in the way of moral fiber.

It’s too bad “War Dogs” can’t settle on a tone and find a satisfactory balance between men-behaving-badly humor and relevant social commentary. Bent on illustrating the idea that war boils down to money, the filmmakers forget that comedy is also serious business, and can carry its own moral import.

The film contains several scenes of violence and gunplay, cohabitation, frequent drug use, pervasive rough and crude language and some sexual banter. (L, R)