Suppose Alice writes a piece of code that (in the immortal words of GPLv2) "makes passes at compilers". It uses a novel technique that makes passes at n lines of code in O(sqrt(n)) time. Alice applies for a patent on this, and let's say for the sake of argument the patent is granted. She also publishes the code under, let's say, the MIT licence.
Bob takes this code and uses it as the core of his new proprietary compiler-passer, taking care to preserve Alice's copyright notices and the text of the MIT licence. From a copyright standpoint, this is completely lawful, because he has a copyright licence to do this, and has satisfied the conditions thereof. But Alice then sues him for patent infringement. From a free-software perspective, this is undesirable.
A patent-granting copyright licence is one that, in addition to copyright, also licences any patents held by the licensor and embodied in the code so licensed; examples include Apache2, in section 3, and GPLv3, in section 11. In both cases, those licences contain a grant for any patents that are licensable by the copyright licensor and which are embodied in the licensed code. Bob can use that code, subject to the terms of the copyright licence thereon, without fear that Alice will sue him for patent infringement.
If so, is there an opposite, i.e. an open source license that gives license to the code but not any related patents?
Yes; CC0 is one such example, in section 4a:
No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
See this question for more details about that.