This is due to the foaming agents used in most toothpastes. The biggest culprit is sodium lauryl (ether) sulphate (SLES/ SLS). These foaming agents are surfactants and they bind to certain taste receptors in your mouth, thus altering your taste perception. You can avoid this entirely by switching your toothpaste to something that uses no foaming agents or those of the non-surfactant type.