A differentiable transformation of R^n at each point has an invertible derivative. Does it imply that the transformation is a global diffeomorphism?

Let $f:\mathbb{R}^n\rightarrow M\subseteq\mathbb{R}^n$ be the differentiable transformation, with $M=f(\mathbb{R}^n)$. If $M\neq\mathbb{R}^n$, then obviously $f$ isn't an global diffeomorphism of $\mathbb{R}^n$. But it is global diffeomorphism between $\mathbb{R}^n$ and $M$. *This was intended to be a comment not an answer, but I cannot comment, sorry. * 

