TITLE: What is the relationship between $\mathbb{A}^n_k$ and $\operatorname{Spec} k[x_1, \dots, x_n]$ for an algebraically closed field $k$?
QUESTION [5 upvotes]: I have seen that due to Hilbert's Nullstellensatz that every maximal ideal of $k[x_1, \dots, x_n]$ is of the form $(x_1-a_1, \dots, x_n - a_n)$ and hence we obtain a bijection between the maximal ideals of $k[x_1, \dots, x_n]$ and $\mathbb{A}^n_k$.
Specifically the map $\operatorname{MaxSpec} k[x_1, \dots, x_n] \to \mathbb{A}^n_k$
given by $(x_1-a_1, \dots, x_n-a_n) \mapsto (a_1, \dots, a_n)$ is a bijection.
Now, I have seen in this question: What *is* affine space?, that apparently $\operatorname{Spec}k [x_1, \dots, x_n]$ is bijective to $\mathbb{A}^n_k$. But then doesn't this imply (taking the above into account) that $\operatorname{MaxSpec} k[x_1, \dots, x_n] = \operatorname{Spec} k[x_1, \dots, x_n]$? Then this would then imply that all prime ideals in $k[x_1, \dots, x_n]$ are maximal which is not the case, so this must be a contradiction, which leads me to believe that there is no bijection between $\operatorname{Spec}k [x_1, \dots, x_n]$ and $\mathbb{A}^n_k$ in general.
But I have seen, stated in examples in some Algebraic Geometry books, that for a field $k$, we have that $$\operatorname{Spec} k[x_1, x_2] = \mathbb{A}^2_k.$$
However, there is a question about this here: What do prime ideals in $k[x,y]$ look like? which seems to indicate otherwise (and which also makes the case that we don't have a bijection between $\operatorname{Spec} k[x_1, \dots, x_n]$ and $\mathbb{A}^n_k$ in general).
So my two questions are

What is the precise relationship between $\operatorname{Spec} k[x_1, \dots, x_n]$ and $\mathbb{A}^n_k$ for general $n$?
In the case $n=2$, do we know that $\operatorname{Spec} k[x_1, x_2] = \mathbb{A}^2_k$?

I think for question one, at the moment, all I can say is that there is an injection $\mathbb{A}^n_k \hookrightarrow \operatorname{Spec} k[x_1, \dots, x_n]$ since we have the bijection between $\operatorname{MaxSpec} k[x_1, \dots, x_n]$ and $\mathbb{A}^n_k$.

REPLY [9 votes]: You may think you are unambiguously talking about specific mathematical objects here, but "$\mathbb{A}^n_k$" has (at least) three different meanings and "$\text{Spec } k[x_1, \dots x_n]$" has (at least) two (maybe as many as four depending on how you count it). $\mathbb{A}^n_k$ can refer to

the set of points $k^n$, when $k$ is algebraically closed, regarded as a "concrete affine variety." This is, by the Nullstellensatz, the same as the maximal spectrum of $k[x_1, \dots x_n]$, but ignores the non-maximal prime ideals.
the topological space of prime ideals $\text{Spec } k[x_1, \dots x_n]$ with the Zariski topology. This is probably the least common meaning but it's worth pointing out. This is, of course, not the same as $k^n$.
the (affine) scheme $\text{Spec } k[x_1, \dots x_n]$ over $\text{Spec } k$, thought of either as a locally ringed space or via its functor of points, which is $R \mapsto R^n$ (for $R \in \text{CAlg}(k)$).

Different meanings of these symbols are appropriate to different levels of abstraction in your study of algebraic geometry. It's unfortunate that there isn't clearer terminology for distinguishing these but this is just something you have to deal with.
The unambiguous way to refer to $k^n$ is $\mathbb{A}^n(k)$.