It's true-ish. Goldfish don't naturally stop growing, but if their environment is poor (which is usually the case in a smaller tank), they won't be healthy and that will stop/slow their growth.
There is an element of truth to this, but it is not as innocent as it sounds and is related more to water quality than tank size. When properly cared for, goldfish will not stop growing. Most fishes are in fact what are known as indeterminate growers. This means that, unlike humans, they grow until they die. What really stunts a fish’s growth is poor water quality and improper care. In smaller aquariums or bowls, water quality is typically very poor. With little or no filtration and infrequent water changes, goldfish suffer. The stunting that results is not a good thing. Rather, it is a sign of ill health, and, frequently, stunted fish take on a deformed appearance and die at a young age. As already stated, some goldfish grow very large, so it is important to know what size your fish will attain before purchase and to make sure you can provide it with the proper care it requires.
Goldfish FAQ on Tropical Fish Magazine