Pre-money and post-money
Pre-money is what the company is worth before the check. Post-money is pre-money plus the check. Ownership is the check divided by post-money.
The arithmetic is short: post-money = pre-money + new money, and the investor's share = new money divided by post-money. $5M into $20M pre is $25M post, and the investor owns 20%. Founders often quote the pre-money and investors think in post-money, which is one reason the same deal can be described two ways.
Price per share comes from the pre-money divided by the number of shares that exist before the round on a fully diluted basis, and that count usually includes the new option pool the investor asked for. That is the option pool shuffle, and it is the single most common way a headline valuation is quietly lower than it looks.
When someone says "we raised at $20M" they almost always mean post-money if the round was a SAFE and pre-money if it was priced. Ask. The difference on a $5M round is 25% of the number.