Cryptographic algorithm for knowing who has more money? I recall reading about this but forgot what it’s called.

Suppose two people want to know who is richer but don’t want to reveal their net worth to the other. How can they securely exchange info to determine who’s number is larger?
You are looking for Yao's Millionaire Problem:

Yao's Millionaires' problem is a secure multi-party computation problem which was introduced in 1982 by Andrew Yao, a prominent computer scientist and computational theorist. The problem discusses two millionaires, Alice and Bob, who are interested in knowing which of them is richer without revealing their actual wealth.
This problem is analogous to a more general problem where there are two numbers ${\displaystyle a}$ and ${\displaystyle b}$ and the goal is to solve the inequality ${\displaystyle a\geq b}$ without revealing the actual values of ${\displaystyle a}$ and ${\displaystyle b}$.