Big Tech isn't getting a lot of love right now.

Month after month of privacy scandals, regulatory threats, trade anxieties and other inauspicious events have soured many investors -- and the public at large -- on companies that were once darlings of the market. 

Now, companies are trying to build goodwill -- in some cases, by making investments to address the problems that critics charge them with creating.

For example, Microsoft (MSFT)   recently announced that it's committing $500 million to support affordable housing in the Seattle area, which has seen housing prices skyrocket 96% over the past eight years, well outpacing the median earnings in the area. In the form of development grants and loans, the funding will be split between low-income and middle-income housing programs, with the rest dedicated to mitigating homelessness in the region. Along with Amazon (AMZN) , Microsoft is among the largest employers in the region. 

"Ultimately, a healthy business needs to be part of a healthy community. And a healthy community must have housing that is within the economic reach of every part of the community, including the many dedicated people that provide the vital services on which we all rely," wrote Microsoft's CFO Amy Hood in a blog post.

Microsoft's funding commitment resonated well beyond the Seattle area. The Bay Area, home to Facebook (FB) , Alphabet (GOOGL) , Apple (AAPL) and many other fast-growing firms, is another microcosm of how successful -- and how divisive -- the tech industry has become. New development of homes and transportation hasn't remotely kept pace with the industry's dramatic expansion in recent years, driving an affordability crisis, profound levels of inequality, and no small measure of antipathy towards Big Tech. In New York, the forthcoming arrival of Amazon's second headquarters in Long Island City, Queens brought similar tensions to the surface, with Amazon's HQ2 announcement drawing outrage from many local residents.

"It's a double edged sword," said Al Nagy, mayor of Newark, Calif., a city about 10 miles away from Facebook's Menlo Park headquarters and nearby by many other tech campuses. While skyrocketing property values can help pay for better services, he said, "the effect has been less affordability. The tech companies are doing more than ever to address the issue, but it's still just a drop in the bucket."

Facebook and Alphabet, for instance, each plan to build employee housing near their respective headquarters, having proposed multi million-dollar developments that mix units earmarked for employees with a percentage of affordable rentals as required by law. But the regional housing crisis is so widespread that it's unknown how much they will do to make local housing costs more affordable. 

"In the big picture, they aren't doing much to offset the housing crisis because the need is so great," Nagy added.

To be sure, the Bay Area's affordability crisis is a complex problem that no single corporation, policy proposal or monetary pledge can resolve. In other areas, tech companies are trying to boost their reputations through social impact investments of a kind: Facebook, for instance, aims to mend fences with the news industry -- which it's been accused of handicapping -- by recently pledging $300 million to small, local newsrooms across the country. As part of its New York expansion, Amazon promised to deliver certain community benefits like new greenery, infrastructure investments and donated space for tech and arts incubators.

Such investments are more than just PR initiatives, however. According to Andre Shepley of Truvalue Labs, they're also in the interests of shareholders who increasingly view good corporate citizenship as a competitive advantage, too.

Truvalue Labs tracks the ESG performance (shorthand for environmental, social, governance) of public companies, and Shepley noted that over time, strong ESG performance correlates with strong financial performance. Investors are taking note.

"The market is rewarding these companies by paying a bigger multiple on earnings -- that's been a recent trend, and that's why you're seeing investors getting up to speed on those factors," Shepley said.

It's not just a sense of altruism -- a high level of responsibility can signal to investors that a company is likely to avoid a major embarrassment, like the 2015 emissions scandal that crippled Volkswagen, or the ongoing privacy issues that have battered Facebook's stock.

As concerns over data misuse have intensified in the past year, data privacy and digital wellness have begun to emerge as consequential ESG factors, Shepley said.

"There's a lot of company value that's tied up in goodwill and intangibles, where things like reputation and trust are huge," he added.

It's hard to know whether community investments are enough to instill trust in Big Tech. But for shareholders, they're another investment worth paying attention to. 

Facebook, Amazon, Microsoft, Apple and Alphabet are holdings in Jim Cramer's Action Alerts PLUS member club. Want to be alerted before Jim Cramer buys or sells these stocks? Learn more now.