By Peter Rudegeair

Square Inc.'s Cash App looks a lot like a bank -- digitally storing and transferring money for users. Investors don't seem to mind.

Square shares have rallied 28% in the past month and are up 166% since the start of the year, while bank stocks have fallen sharply. The run-up is mostly due to the popularity of its Cash App offering, which lets consumers send money to one another via smartphone, purchase things with a prepaid debit card and invest in bitcoin and slices of individual stocks, analysts and investors said.

Those businesses took off during the coronavirus pandemic. Cash App revenue more than doubled to $325 million, excluding sales of bitcoin, in the second quarter from a year earlier.

Thanks in part to Square's making it easy for individuals to accept their stimulus checks and unemployment benefits in Cash App, the amount of money stored there reached $1.7 billion in the second quarter, 3 1/2 times more than in the same period last year. Monthly active users topped 30 million in June.

Square shares closed at $166.66 Tuesday, up from $61.84 a year ago.

Stock analysts at Bernstein Research estimate that investors are currently pegging Cash App's value at as much as $40 billion, or more than half of Square's overall market capitalization. At that valuation, Cash App is worth more than Capital One Financial Corp., First Republic Bank and all but roughly a dozen U.S. banks.

"One has to be a bull on Cash App to be a bull on the stock," Bernstein analyst Harshita Rawat said in a July presentation. "Almost all of the stock performance has been driven by the Cash App."

Investors have shunned bank stocks in recent months, betting that ultralow interest rates and the prospect of widespread defaults on credit cards, commercial mortgages and other loans would erode their profits. The KBW Nasdaq Bank Index of 24 large lenders is down 32% since the start of the year.

Square also fell out of favor among investors earlier this year when foot traffic to the small businesses for which it processes payments cratered due to stay-at-home orders and business shutdowns. Its stock declined more than 50% over the course of three weeks in March, and though the shares have more than recovered, many of Square's small-business customers haven't. The volume of payments it processed for its merchants fell 15% to $22.8 billion in the second quarter.

Cash App isn't reliant on lending or in-store payments. Analysts estimate its biggest source of revenue comes from a 1.5% fee it charges users who want to transfer funds out of their accounts instantly. Cash App also earns a fee when users make a purchase with the prepaid debit card that is linked to their accounts, transactions that Square encouraged during the pandemic by offering discounts when people used popular services like DoorDash Inc.

"They've executed phenomenally on increasing the relevance of Cash App as an alternative banking service," said Anthony Zackery, a portfolio manager at Zevenbergen Capital Investments LLC, which holds more than 700,000 shares of Square across the funds and accounts it manages. "If consumers and Cash App users get on the system and like what they see, I don't think they're going to close down their Cash App accounts and go back to legacy, old-school ways of banking."

Square has also recruited hip-hop artists, one of Cash App's most devoted fan bases, to help bring aboard new users during the pandemic. To promote Cash App and their new single, "WAP," rappers Cardi B and Megan Thee Stallion gave away $1 million to fans who messaged them on Twitter with their Cash App usernames, called "cashtags."

Cash App's popularity notwithstanding, Square's valuation is much more stretched than those of most other U.S. stocks. It trades at a whopping multiple of 174 times its expected earnings over the next 12 months, compared with the S&P 500 index's forward price/earnings ratio of about 23, according to FactSet. Square lost roughly $117 million in the first six months of 2020, yet its overall market capitalization exceeds that of Goldman Sachs Group Inc.

"If you look at the owners, a lot of those disruptive growth-type investors are the ones that have been attracted to the story," said Josh Beck, an analyst at KeyBanc Capital Markets. "You have to think of this more like you'd think of Facebook or LinkedIn where there's a big virality."

Other analysts caution that there are risks Cash App won't be able to keep its current growth going. The boost it got from stimulus checks could be fleeting. The 1.5% fee Cash App charges for instant transfers could come under scrutiny for resembling payday loans, as could its arrangements with smaller banks to offer the services Square can't offer itself because it lacks a consumer-banking license, said Bernstein's Ms. Rawat in the July investor presentation.

A spokeswoman for Square declined to comment.

"Right now Cash App is flying under the radar because Square is serving an unmet need in the market," Ms. Rawat said. "But as they grow bigger, that could change."

Write to Peter Rudegeair at Peter.Rudegeair@wsj.com