The passage of North Carolina’s House Bill 2, a law that bans transgender people from using the public bathrooms that match their gender identities, has inspired an unusually vocal protest from private businesses, many of which have been silent on other divisive national debates on gender and civil rights.

The latest public rebuke came from nearly five dozen private and public investment groups, including Morgan Stanley and New York State’s pension fund, who released a signed letter Monday warning that the law “is making it difficult for our portfolio companies to provide the safe, open, and inclusive environment necessary for a successful workplace”.

“Not only does HB2 make hiring top talent difficult, but it also has negative financial implications that reverberate across North Carolina,” the letter said.

The investors joined a growing roster of businesses, including big sports organizers such as the National Basketball Association and the National Collegiate Athletic Association, to loudly register their disapproval of the law. Some moves, such as canceling games or concerts – headliners including Bruce Springsteen and Pearl Jam pulled planned performances from the state – inflict significant financial impact on the local economy. All told, the NBA’s decision to move the 2017 All-Star Game from Charlotte to New Orleans will divest an estimated $100m dollars in profits from the city of Charlotte, no small loss for a place with more than 45,000 jobs directly tied to tourism.

“Discrimination of any kind cannot be allowed,” tweeted Kevin Durant of the NBA’s Golden State Warriors.

Some companies went even further by vowing to suspend business operations in the state for as long as the law was still in effect. PayPal, for instance, reneged on a promised $3.6bn investment there, and Deutsche Bank canceled plans to hire 250 people in North Carolina in 2017.

A group of about 100 major companies urged North Carolina Governor Pat McCrory to repeal the law, a number that eventually swelled to more than 180, including Apple, Airbnb, Bank of America, Starbucks and United Airlines. They partnered with the transgender advocacy groups Human Rights Campaign and Equality NC to sign a widely shared letter stating that laws like HB2 “are bad for our employees and bad for business”.

It’s not unusual for companies to take a stance on controversial social issues. Back in 1993, the National Football League refused to hold the Super Bowl in Tempe, Arizona, because the state would not honor Martin Luther King Jr with a holiday.

But North Carolina’s legislation appears to have drawn a much more fierce response from a wide range of businesses. The same can’t be said for other divisive issues such as the right to vote and abortion. Since when have so many companies been such vocal supporters of transgender rights? How did the private sector become so activist?

Deena Fidas, director of the workplace equality program at the Human Rights Campaign, said the transgender issue is benefiting from a long held recognition by businesses that protecting their gay, lesbian and bisexual employees from discrimination directly affects their ability to attract talent and make money.

“They were saying it was both the right thing to do, and also it was the right thing for their businesses,” said Fidas, who called 2011 “the tipping point” in terms of companies getting vocal in support of lesbian, gay, bisexual and transgender (LGBT) people.

But behind closed doors, the Fortune 500 actually has a track record of working with LGBT rights groups. During the 1990s and 2000s, before the tide of public opinion had fully turned in favor of same-sex marriage rights, LGBT employees began forming working groups at their companies to seek same-sex partner benefits, diversity training programs and LGBT anti-discrimination policies at their offices. After a while, companies realized that if they wanted to attract and retain the best employees, they’d better step up.

“For businesses, matters of LGBT inclusion are very tied to their business goals,” said Fidas. “We have been working with businesses going on two decades.”

Still, taking a public stand on LGBT rights didn’t happen quickly. Less than five companies spoke out publicly in opposition of California’s Proposition 8, a 2008 ballot amendment that defined marriage as a union between a man and a woman, which was eventually overturned.

But by 2011, when New York state was considering same-sex marriage, the leaders of more than two dozen major companies including Goldman Sachs and Morgan Stanley, supported the state’s proposed Marriage Equality Act.

North Carolina became ground zero for the transgender bathroom debate because it was the first state to pass the law in March of this year. Other states that have considered similar legislation within the last few years included Florida, Texas and Minnesota. North Carolina’s law also bars local authorities from floating any anti-discrimination protections for LGBT residents, which US Attorney General Loretta Lynch denounced as “state-sponsored discrimination”.

Fidas is director of HRC’s Corporate Equality Index (CEI), an annual survey of more than 1,200 major companies that launched back in 2002 in order to catalogue what kinds of employment benefits and workplace inclusion policies were available for LGBT workers. Not only do the majority of the companies polled by CEI now offer same-sex partner benefits to employees, but more than 500 companies now offer at least one health care plan that includes appropriate coverage for transgender employees, according to the 2016 CEI survey. And 75% of Fortune 500 companies have anti-discrimination policies that include gender identity, up from just 3% in 2002.

“If you look at the advancement of the rights in Fortune 500 companies compared to [LGBT] rights in the states, Fortune 500 companies were way more progressive than the states or any of the governments were,” said Brayden King, a management and organizations professor at Northwestern University’s Kellogg School of Business.

King, whose research focuses on the way activists influence corporate social responsibility and legislation, says that executives are increasingly taking stronger public stances on issues such as climate change and LGBT rights.

“Business leaders are standing up and recognizing that they have to fill the void that’s being left in many places and many states by state policymakers,” he said. “Many of those companies and executives feel morally that it’s bad for our culture to discriminate. I really believe that. But these are also executives who have to consider the economic impact of what they do.”

In King’s 2011 study of some 133 different boycotts that occurred between 1990 and 2005, he discovered that a boycotted company’s stock price would fall an average of 0.7% for each day it made national media headlines.

In other words, the concern about being boycotted “isn’t that it hurts revenues or sales,” King said. Rather, it’s about reputation. “Companies care so much about reputation because it’s really hard to put a dollar value on how people perceive you. We do know that if people perceive you badly, it can take years and years and years [to dispel that].”

Likewise, in the case of North Carolina and HB2, King says: “People will remember North Carolina for years after this has settled down as the state that has been associated with this controversy. They could change tomorrow, but people will still associate it with this discriminatory action it decided to take.”

He added, “The boycott becomes a permanent part of that state’s narrative history, and that is fundamental to the reputation that that state has.”

Indeed, years after same-sex couples and supporters staged “kiss-ins” outside Chick-fil-A restaurants across the country in protest of the company’s vocalized opposition to gay marriage, Chick-fil-A CEO Dan Cathy expressed some regrets.

“Consumers want to do business with brands that they can interface with, that they can relate with,” he told the Atlanta Journal-Constitution in 2014. “And it’s probably very wise from our standpoint to make sure that we present our brand in a compelling way that the consumer can relate to.”