Mergers and acquisitions are fairly common in San Francisco’s and Silicon Valley’s tech industry. Why should its beer industry be any different?

Silicon Valley’s top 150 firms made $41 billion in acquisitions last year. Microsoft Corp. MSFT, -1.24% bought LinkedIn, Oracle Corp. ORCL, -0.71% bought NetSuite, Western Digital Corp. WDC, -2.79% bought SanDisk, VTech Holdings Ltd. VTKLY, -0.41% bought LeapFrog. Each acquisition held something of worth for the buyer, while each seller faced a challenges going it alone.

San Francisco brewery acquisitions have come at a similar pace in 2017, and for similar reasons. Speakeasy Ales & Lagers, which has been brewing since 1997, found itself $7.5 million in debt after expanding in 2015. When it was unable to pay, it stopped production, cut staff and put itself in receivership in March. It had to lean on Clifton Park, N.Y. brewer Shmaltz to brew its beers under contract until, in May, it was sold for $2.5 million to a parent company founded by a former beer distributor. That sale transferred ownership of the Speakeasy brand and its assets, but none of its outstanding debt.

In July, 21st Amendment Brewery — which has operated in San Francisco since 2000, has been a fixture in the South Park neighborhood and opened a multimillion-dollar production facility in San Leandro in 2015 — announced that it was selling a small stake to Brooklyn Brewery. Nico Freccia, a co-founder of 21st Amendment Brewery, told industry blog Good Beer Hunting that spending on infrastructure left them short on cash for marketing and promotion and distribution. It’s an issue Brooklyn Brewery is all too familiar with after selling nearly a quarter of its own business to large Japanese brewer Kirin Holdings Co. KNBWY, +0.37% .

How to fly on a private jet for under $150

Speaking of large Japanese brewers, Sapporo Holdings Ltd. 2501, +2.31% announced earlier this month that it planned to buy San Francisco’s pioneering Anchor Brewery for $85 million. The 121-year-old brewery helped bring about the craft beer movement roughly 50 years ago, when then owner Fritz Maytag cooled the brewery’s Steam beer in shallow metal coolships on the brewery’s roof, brewed the first post-Prohibition porter, and used Cascade hops and dry hopping to create Liberty Ale — the first West Coast IPA.

However, Maytag sold to the Griffin Group, headed by two former Skyy Vodka executives, in 2010. The two started a distilling operation — which remains independent of the brewery — and, in a parting interview with beer industry publication Brewbound, spoke poorly of the state of the beer industry in San Francisco.

“You have a very high cost base in San Francisco. You have a lot of competition and a declining beer market,” Keith Greggor, the Griffin Group’s co-founder, told Brewbound. “Total beer volumes in San Francisco dropped 10 percent last year. Anchor is also in the spirits business, so we got all of that upside. But if you are an account, do you want to sell someone a beer or a $20 cocktail?”

He has a point about costs. Anchor’s 88,000 square-foot brewing facility opened on Portrero Hill in the 1970s. Monthly commercial rent in San Francisco is $75 per square foot, which would put Anchor’s rent at $6.6 million a month and $79.2 million annually if it didn’t own the brewery. However, Sapporo got the nod primarily because it wasn’t going to sell the facility. With Trulia putting the average price per-square-foot for residential space on Potrero Hill at $1,096, the $96.5 million value of the building even before rent or condominium subdivision is more than the value of the sale.

So why would a former Bay Area distributor, a New York brewer backed by a large Japanese brewer, and yet another large Japanese brewer buy into a market that drove off the spirits guys? For the same reason that New Belgium of Fort Collins, Colo., Belgian brewer Oud Beersel and Elysian Brewing founder Dick Cantwell opted to buy San Francisco’s Magnolia Brewing for $2.7 million: Because it isn’t San Francisco that’s the issue — it’s the beer and brewery owners dwelling on San Francisco’s past.

Magnolia Brewing was founded in 1997, but filed for bankruptcy in 2015. It managed and reorganized debt enough to keep brewing and release its first line of canned beers this year, but still wasn’t quite out of the clear. New Belgium co-founder Kim Jordan and Cantwell live in San Francisco and became familiar with Magnolia and founder and brewer Dave McLean. Instead of taking over McLean’s brewery and running it as-is, Cantwell and Oud Beersel envision brewing spontaneously fermented lambic-style beers under the Magnolia flag.

Read more: How everything changed for a craft beer brewer after it sold itself to MillerCoors

What makes them think it would work? Because one of Magnolia’s popular neighbors in San Francisco’s, Almanac Beer Co., has been doing so since 2010. Almanac produces 9,000 barrels of its barrel-aged and spontaneously fermented beers each year, compared to the 6,000 produced by Magnolia when it entered bankruptcy in 2015, and has a taproom in San Francisco’s Mission District. It’s also about to open a new facility in Alameda shared with Admiral Malting — which just happens to be co-owned by Magnolia’s McLean.

Breweries including Cellarmaker, Harmonic, Cervecería de MateVeza, and Laughing Monk all followed and put the pinch on longer-tenured breweries like Magnolia, Speakeasy, 21st Amendment, and Anchor. They also embraced a more urbane array of styles and a flair for experimentation that compared favorably when Mikkel Borg Bjergsø — founder of the Denmark-based Mikkeller brand and its more than 30 locations around the world — opened Mikkeller Bar SF in 2013.

That new wave of brewers, as well as the recent wave of brewery buyers, realizes how both San Francisco and the brewing industry have changed in recent years. The overhead is great, but so is the opportunity. Old ideas can get steamrolled and even folks with good ideas can get overwhelmed if they don’t have the right backing.

San Francisco’s culture and technology help set the pace for the world, but its beer scene can’t be content with holding onto its history while being overshadowed by Chicago, Asheville, N.C., Portland, Ore., Seattle or (shudder to think) San Diego. San Francisco is a cosmopolitan city, and it’s good to see both buyers and brewers making the city’s beer as worldly as its other exports.

Jason Notte is a freelance writer based in Portland, Ore. His writing has appeared in The New York Times, The Huffington Post and Esquire. Follow him on Twitter @Notteham.