Is Hartshorne exercise II.2.15(b) correct as written?
The problem here is that you have forgotten the condition that $X\to Y$ be "a morphism of schemes over $k$". This condition applied in your case means that the isomorphism $K\to M$ is a morphism of $K$-algebras. Once we enforce this, the sequence of inclusions $K\subset L\subset M$ is an inclusion of $K$-vector spaces, so $K=L=M$ by dimension considerations.
Edit: This question ends up hinging on different interpretations of what exactly the statement "$P\in X$ is a point with residue field $k$" means. $k(P)$ is equipped with the structure of a $k$-algebra from the fact that $X$ is a scheme over $k$, and the intended statement here is that $k(P)$ with the $k$-algebra structure coming from $X$ being a scheme over $k$ is isomorphic to $k$ with the trivial $k$-algebra structure as a $k$-algebra, which is a more restrictive condition than just $k(P)\cong k$ as fields, as you have noticed. If one enforces this intended statement, then all opportunity for funny business is eliminated and the original answer, preserved above, is sufficient.