I have this question and I can't seem to find any sources which I can used to determine a potential answer.
For a traditional foundry sand mold ; the metal freezes as essentially the size of the cavity but then shrinks as it cools to room temperature. So the cavity is larger to accommodate this shrinkage. For a permanent mold or die casting it is similar except the metal die is warm>hot so when it is machined at room temperature , the expansion of the warm die and the shrinkage or the part must be considered. Then there are more complicated situations like investment /shell casting. A plastic pattern is made by injecting into a warm die > the plastic shrinks to room temp . The plastic is embedded in ceramic > the ceramic is heated to high temp ( eg. 1600 F) and expands > the metal is poured in and freezes at about 1600 F then shrinks down to room temp. Experience helps in determining what size the die cavity for the plastic part should be at room temp.
Moulds have to be fractionally larger and have a release angle so that the parts will come out.
If the parts are larger than the mould then that is an interference fit and it can be very difficult to remove parts unless one is heated...