Let $K$ be the field of rational numbers, $A=K[x]$ be the ring of polynomials with coefficients from $K$, and $I=(x)$ be the ideal of polynomials $f$ with $f(0)=0$.
As $A$-modules, $I \cong A \cong I \otimes_K K \cong A \otimes_K K$, but $I \neq A$.
One of course has cancellation up to isomorphism: if $M$ is an $A$-module, then $M \otimes_K K \cong M$ as $A$-modules, so if $I \otimes_K K \cong A \otimes_K K$, then $I \cong I \otimes_K K \cong A \otimes_K K \cong A$.
If $A$ is a finite dimensional algebra, then things are better: if $I \otimes_K K \cong A \otimes_K K$ then both $I$ and $A$ have the same dimension as $K$-vector spaces, and since $I \leq A$ and $A$ is finite dimensional, one must actually have equality: $I=A$.
If $A$ is actually an algebra over a subfield of $L$, and you want to change fields to $K$, then look for "separable algebra" to see cases where things behave reasonably.