Epistasis is when the expression of an allele of one gene masks the expression of the alleles of another. Let’s use flower colour as an example.
Epistasis example: flower colour
In the diagram below, the flower pigment molecule begins as white. In order for the white pigment to be converted into a blue pigment, the plant must express a dominant allele of the gene coding for enzyme 1. Enzyme 1 converts the white pigment into a blue pigment. So if the genotype is BB or Bb, the flower has the potential to be blue. If the genotype is bb, the flower will always be white.
A second gene codes for enzyme 2, which converts the blue pigment into a purple pigment. Again, a dominant allele must be expressed (genotype MM or Mm). However, the blue pigment can only be converted into the purple pigment if the blue pigment was there in the first place; if the flower has the bb genotype for the enzyme 1, even if it is MM or Mm for enzyme 2, the flower will be white. The bb genotype masks the expression of the M allele. The diagram shows the possible genotypes that the flowers of each colour could have.

As we saw with linkage, epistasis can also result in unexpected phenotypic ratios. To work out the phenotypic ratio you would expect with epistatic genes, you can draw a Punnett square for a dihybrid cross as usual, but then you have to think carefully about what phenotype would go with each genotype (see diagram above).
Summary
- Epistasis is when expression of an allele of one gene masks the expression of the alleles of another.
- Unexpected phenotypic ratios can emerge from dihybrid crosses if the genes interact via epistasis.