Counterintuitively, capital losses can contribute to an overall gain after taxes, but investors must beware of certain Code sections that seek to limit losses.