Somatic mutations are those that are acquired during the formation of cancer and are not present at birth.
That said, there is overlap between the two that adds further confusion.
Some mutations are harmful, some do not cause any changes, and some are actually beneficial.

janiecbros / Getty Images
Genes can be damaged in a number of ways.
Each three base sequence is associated with a particular amino acid.
Proteins, in turn, are formed by chains of amino acids.
Simplistically, mutations may involve the substitution, deletion, addition, or rearrangement of base pairs.
In some cases, parts of two chromosomes may be interchanged (translocation).
Tumor suppressor genes:Tumor suppressor genescode for proteins that essentially have an anti-cancer effect.
Examples of tumor suppressor genes include theBRCA1 geneand thep53 gene.
How Gene Mutations Occur
Genes and chromosomes can be damaged in a number of different ways.
They may be damaged directly, such as with radiation, or indirectly.
Substances that can cause these mutations are referred to ascarcinogens.
An example is the role of nicotine in cancer.
Mutations also occur commonly due to the normal growth and metabolism of the body.
Every time a cell divides, there is a chance that an error will occur.
Epigenetics
There are also non-structural changes that appear to be important in cancer.
They are present only in the cells that become malignant tumors and not all the tissues of the body.
Somatic mutations that occur in the embryo may affect more cells.
For example, some genetic changes consist of rearrangements and more.
The term germline is due to the mutations being present in eggs and sperm which are called germ cells.
These mutations are in all cells of the body and remain throughout life.
Germline mutations may be dominant or recessive.
In autosomal recessive diseases, two copies of the mutated gene are required to cause the disease.
Germline mutations also vary in their penetrance.
High and low penetrance is easier to understand if you think about the function of a gene.
A gene usually codes for a specific protein.
(There are actually many ways in which the BRCA2 gene can be mutated.)
The science surrounding the genetics of cancer is expanding rapidly, but in many ways still in its infancy.
Its likely that our understanding of hereditary/familial cancer will increase significantly in the near future.
Genome-wide association studies(GWAS) may also be revealing.
Specific Mutations May Be Somatic or Germline
Some gene mutations can be either hereditary or acquired.
For example, most p53 gene mutations are somatic, or develop during adulthood.
Much less commonly, p53 mutations can be inherited, and give rise to a syndrome known asLi-Fraumeni syndrome.
Some people treated with EGFR inhibitors develop a resistance mutation known as T790M.
This secondary mutation allows the cancer cells to bypass the blocked pathway and grow again.
In some cases, actions can then be taken to reduce the risk.
American Cancer Society.Gene changes and cancer.
American Cancer Society.Oncogenes, tumor suppressor genes, and DNA repair genes.
2020;54(1):34-44. doi:10.4132/jptm.2019.11.03
American Lung Association.HER2 and lung cancer.
Joyce C, Rayi A, Kasi A.Tumor-suppressor genes.
Treasure Island (FL): StatPearls Publishing; 2023.
Yamamoto H, Yatabe Y, Toyooka S.Inherited lung cancer syndromes targeting never smokers.Transl Lung Cancer Res.
2018;33(3):450-462.e10.
2015;15(12):747-756. doi:10.1038/nrc4015
National Cancer Institute.Genetic testing for inherited cancer risk.