The keg is becoming the new water cooler.
At least, that's the case at such firms as the Boston advertising agency Arnold Worldwide, where workers cluster around a beer-vending machine—nicknamed Arnie—after the day's client meetings are done. As they sip bottles of home-brewed beer, employees exchange ideas and chitchat, often sticking around the office instead of heading to a nearby bar.
Plenty of offices provide free food to their workers, but as the workday in many tech and media companies stretches past the cocktail hour, more companies are stocking full bars and beer fridges, installing on-site taverns and digitized kegs and even deploying engineering talent to design futuristic drink dispensers.
The perk, firms say, helps lure talent, connects employees across different divisions and keeps people from leaving the office as the lines between work and social lives blur.
But employment lawyers worry that encouraging drinking in the workplace can lead to driving while intoxicated, assault, sexual harassment or rape. Plus, it may make some employees uncomfortable while excluding others, such as those who don't drink for health or religious reasons.
Drinking on the job has long been part of work life in the U.S. and abroad, whether it's a beer with colleagues in the United Kingdom or Japanese salarymen entertaining clients at sake bars. But holding happy hour in the office is different, experts say, because it brings after-hours activity into the professional space.
At the New York-based company Thrillist Media Group, teams frequently pop open beers at the end of the day and hold regular liquor tastings, often sponsored by the site's alcohol advertisers. Allowing workers to drink on the job may even keep them at their desks longer, says Thrillist's founder, Ben Lerer.
"This is a group of adults," says Mr. Lerer. "I'm fine if you are having a beer out on your desk, sticking around and doing more work and enjoying yourself doing it." Plus, there are nonalcoholic alternatives. But if an employee is getting drunk, he says, "Go home."
Jay Chinthrajah, a technical lead at Thrillist and a competitive runner in his spare time, usually chooses ginger ale over beer. Co-workers sometimes wonder why, he says, but the gatherings are "more about the experience of stepping out from your desk and interacting with people."
Some firms tout their free booze as a way to signal to in-demand workers that their company isn't stuffy, bland and corporate. The recruiting site for the online-storage firm Dropbox, for instance, touts its "Whiskey Fridays" soon after such perks as health and dental insurance. (A firm spokeswoman declined to comment.)
Desk-side drinking seems to happen most often in urban workplaces where employees tend to be young, male and unattached.
As tech firms, in particular, have come under fire for anemic diversity, researchers say that office drinking may turn off anyone who doesn't fit the demographic, such as parents, people of color or those with strong religious views, not to mention recovering addicts and alcoholics.
"These are well-intentioned practices, but they can make people uncomfortable," says Wharton professor Nancy Rothbard, who studies workplace socializing.
In her research, Dr. Rothbard has found that workplace social events, such as happy hours, increase bonding among like groups of employees—such as young white males—but tend to make those who are dissimilar feel less comfortable.
"People who were racially dissimilar weren't having as positive an experience at these events," says Dr. Rothbard. "They felt it was almost an obligation to attend."
Christina Wallace, the director of the Startup Institute, a New York career bootcamp, says that the fraternity-house cultures at some startups can be off-putting.
"When you are predominantly young men and you have a kegerator right next to the ping pong table, that can be a big turnoff," she says.
Liability issues also abound. If employers serve alcohol and something goes awry as a result, the company may be on the hook, says employment lawyer Craig Annunziata, although some of the risk may be covered by liability insurance. "I'm not seeing a lot of upsides when there is alcohol in the workplace," he adds.
Yet, say proponents, light drinking on the job can help workers connect and make them feel appreciated, especially when they are expected to work long hours to complete a project or build a fledgling company.
"It is a very easy way to keep employees committed," says Paul Roman, a sociology professor at the University of Georgia who studies workplace drinking. "You don't need to go off and spend eight bucks on premium beer; you can enjoy it for free on company grounds."
Some firms are tapping the keg on company time. Employees at San Francisco-based review site Yelp Inc. YELP +16.35% and Seattle real-estate site Zillow Inc.Z +1.11% spent "hackathon" periods developing tablet-controlled kegs. At Zillow, the keg creates individual user accounts and snaps photos of staffers as they tap their beer, says Christopher Roberts, who helped develop the "kegbot."
Companies are also keeping an eye on what employees consume.
Arnold in Boston isn't exactly the hard-drinking ad agency portrayed on television's "Mad Men": Workers get three to five drink credits a month, and managers can allot more to reward their charges.
"It's enough to get you through the month," says Matt Karolian, a social-media strategist who helped develop Arnie.
Write to Rachel Emma Silverman at rachel.silverman@wsj.com