Finite-dimensional algebras isomorphic as commutative unital rings

For which fields $$k$$ do there exist two finite-dimensional $$k$$-algebras of different dimension which are isomorphic as commutative unital rings? Some thoughts:

• for a finite field this can not happen, because the cardinality of the algebra determines its dimension.
• consider any field $$K$$ and the function field $$k=K(x^2)$$, then the one-dimensional algebra over $$k$$ and the two-dimensional algebra $$K(x^2)[x]$$ are isomorphic as commutative unital rings.

To find examples of such fields, it is sufficient to look for fields $$k$$ having isomorphic finite extensions of differing degrees, just like the example given by schematic_boi.

Claim: For a field $$k$$, the following are equivalent:

1. Finite dimensional commutative $$k$$-algebras that are isomorphic as rings always have the same $$k$$-dimension.
2. Finite field extensions of $$k$$ that are isomorphic as fields always have the same degree over $$k$$.

Proof: Clearly 1 implies 2. Suppose 2 holds; to deduce 1, it is sufficient to let $$A$$ be a finite-dimensional commutative $$k$$-algebra and to show that the $$k$$-dimension of $$A$$ can be recovered from the ring-theoretic structure of $$A$$.

To this end, consider the filtration given by the Jacobson radical $$J = J(A)$$: $$A \supseteq J \supseteq J^2 \supseteq \cdots \supseteq J^n = 0.$$ First note that $$A/J \cong F_1 \times \cdots \times F_r$$ is isomorphic to a product of finite field extensions of $$k$$. By hypothesis 2, the dimension $$[F_i : k]$$ of each of these is uniquely determined by the isomorphism type of the field $$F_i$$.

Each filtration factor $$J^i/J^{i+1}$$ is a module over the semisimple algebra $$A/J$$ and therefore is a direct sum of simple modules. These simple modules, including their multiplicities, are uniquely determined (Jordan-Hölder). Because every simple $$A$$-module is isomorphic to a 1-dimensional vector space over some $$F_i$$, its $$k$$-dimension is determined by that $$F_i$$. Thus the dimension of each $$J^i/J^{i+1}$$ is determined by its decomposition into simple modules.

It follows that $$\operatorname{dim}_k(A) = \sum_{i=0}^{n-1} \operatorname{dim}_k(J^i/J^{i+1})$$ is determined entirely by the ring-theoretic struture of $$A$$, from which 1 follows. QED

Remark 1: This begs the question of which fields have property 2, and I certainly do not know the answer. It is true for algebraically closed fields (since there are no nontrivial finite extensions), for finite fields (as noted in the OP), and for algebraic number fields (it holds for $$\mathbb{Q}$$ since any field isomorphism fixes the prime subfield, and property 2 also passes to finite extensions). But Hagen Knaf's answer to this MSE question provides examples of a geometric nature.

Remark 2: If desired, one should be able to remove the assumption of commutativity from property 1 in the claim above. One would need to analyze the Artin-Wedderburn structure of $$A/J$$ more carefully, but this reduces to the case of a simple finite-dimensional algebra $$S$$. One would then apply property 2 to the center $$F$$ of $$S$$ (which is a field), and then note that the dimension of $$S$$ over $$F$$ is determined by the $$F$$-dimension of its unique simple module and the length $$S$$ as an $$S$$-module, all of which is purely ring-theoretic information about the structure of $$S$$.