If you're painting a mask, then the only thing deciding whether it's linear or non-linear is you. It depends on what your intentions are. If you are working with an 8-bit image and you paint a value of 127 or 128 with the intention that it will be exactly half of 255, then you intend the values to be linear and you should tell Terragen to read it in as linear.
The usual reason to choose non-linear is if you're creating a colour image where the values should be turned directly into some kind of light intensity, e.g. a colour texture, or a background image, or maybe if you're working on a specularity map. Basically anything where bright parts of the image should produce bright parts of the rendered image, and dark should produce dark. Why? Because when you paint 127 or 128 in Photoshop, the light produced by your monitor is much less than half of what it produces when you paint 255. Terragen's renderer likes to work in linear space (like photons in the real world), so if it reads the image as linear then it will think that 127/128 should be about half as bright as 255. But this is not what you saw on your monitor on Photoshop or any other 8-bit image viewer. So if you want that 128 pixel to look the same in the final render, you tell Terragen that the image has a gamma of about 2.2. When using an 8-bit photograph as a texture, you almost certainly want to do this. The exact value should really depend on lots of different factors, but 2.2 is a reasonable approximation. You can adjust it to make it look more how you want.
Going back to the example of a mask. Masks might be turned into a displacement magnitude, or control the mixing of two colours, or anything else that isn't supposed to map directly from dark to bright. If you're painting the mask yourself, the choice of linear or non-linear might be something of a personal preference. If you've got used to how masks work with Terragen's default image map settings - which treat the image as non-linear - then there isn't anything wrong with that, but it means that if you invert the image in Photoshop it will be different from inverting it in the shader so you need to be aware of that. And it means that a linear gradient in Photoshop won't produce a linear slope when converted to displacement.
No matter whether you choose linear or gamma space, black is always black and white is always white. The gamma conversion affects values that are somewhere between these two extremes. Well, it also affects values brighter than white, but those can only occur when reading in EXR (or whatever other HDR formats Terragen might support in future), not when working with 8-bit or 16-bit non-EXR images.
Matt