In everyday speech, we usually assume that all nuts—a generic term referring to hard-shelled pods that contain both the fruit and seed of a plant—conflate in a single macro-category, without the due distinctions. However, there’s a preliminary botanical difference between tree nuts and peanuts.
In particular, peanuts—also called groundnuts—are not nuts at all, but legumes, which are edible seeds enclosed in pods and whose family belong beans, lentils, and peas. Meanwhile, tree nuts—which include walnuts, almonds, hazelnuts, cashews, pecans, pistachios, etc.—are all produced on trees.
Furthermore, not all tree nuts are actual nuts in a strictly biological sense, but drupes, that is fruits with an outer shell and fleshy part surrounding a hard seed. (Cherries, plums, peaches, olives, etc. are the typical example of drupes.)
Drupes considered false tree nuts include almonds, pistachios, pecans, and cashews.
Lastly, pine nuts are just seeds rather than tree nuts bearing seeds in fruits. They are edible seeds of certain species of conifers (gymnosperms, which means ‘naked seeds’ in Greek), trees evolutionarily separated from flowering plants (angiosperms) to which all other nuts belong.
Angiosperms—also known as ‘flowering plants’—are the most diverse groups of land plants, including over 300,000 species. Etimologically, ‘angiosperm’ means a plant that produces seeds within an enclosure; in other words, a fruiting plant. The term comes from the Greek words ‘angeion’ (case) and ‘sperma’ (seed.)
Gymnosperms are a more tightened group of seed-producing plants (about 1,000 species), among which are conifers. The term ‘gymnosperm’ comes from the composite word in Greek, ‘gymnos’ = naked and ‘sperma’ = seed. The name is based on the unenclosed condition of their seeds, in contrast with the enclosed seeds of angiosperms within an ovary.