What is the difference between codomain and range?
The codomain and range have two different definitions, as you have already stated. The range is the set of values you get by applying each value in the domain to the given function.
Range = $\{ T(v)$ for every $v$ in the domain$\}$
The codomain is a set which includes the range, but it can be larger. The range is a subset of the codomain.
Consider a linear map $T:\mathbb{R} \to \mathbb{R}$ given by $T(x) = 0$ for all real $x$.
It's clear $T$ is linear. The codomain is indeed $\mathbb{R}$, but the range of $T$ is all points in the co-domain where $T$ maps something, so range of $T$ is $\{0\}$.
The codomain need not be the same as the range. Take any projection operator like $\begin{bmatrix}1&0\\0&0\end{bmatrix}$; its codomain is $\mathbb R^2$ but its range is only the subspace spanned by $(1,0)^T$.
However, it is always true that $T(V)\subseteq V'$ and that the transformation can be restricted to its range ($T': V\to T(V)$) such that range and codomain are equal.