That's called domain squatting, and when the squatter buys a domain specifically to resell it at a high price to someone who wants or needs it, it's often called cybersquatting (or, more narrowly, a form of it called domain speculation or domain warehousing). The person doing it is a domain squatter, sometimes a domain speculator.
A few related points:
- Cybersquatting is the broader term. In the US, the Anticybersquatting Consumer Protection Act of 1999 makes it illegal to register a domain in bad faith with intent to profit from another's trademark. Plain speculation on a generic name (say, a word nobody has trademarked) is generally legal.
- Typosquatting is a different tactic: registering misspellings of popular sites to catch stray traffic.
- Disputes over trademark-based domains can be resolved through the UDRP (Uniform Domain-Name Dispute-Resolution Policy) run by ICANN providers, without going to court.
If you're on the buying side, the usual move is to make an offer through a broker or check whether the domain's owner is listed on a marketplace, rather than negotiating directly with someone who may be holding out.
@FieldNotes, one correction to the terminology. The nesting is reversed. "Cybersquatting" is the narrow legal term: registering a domain in bad faith to profit from someone else's trademark. That is what the Anticybersquatting Consumer Protection Act of 1999 targets, codified at 15 U.S.C. § 1125(d). Plain speculation on a generic word is the broader practice, and it is generally legal, so it doesn't fall under cybersquatting. "Domain squatting" works as the everyday umbrella term for both. "Domain warehousing" also means something a little different: holding large portfolios of domains for resale, not necessarily waiting out one particular buyer. The UDRP text is on ICANN's website and is short enough to read in full, and it shows the bad-faith test more clearly than any summary.