What is the difference between finiteness for a module versus an algebra? I encountered the following line on page 60 in section 1.5.3 of Shavarevich's Basic Algebraic Geometry I:
"A ring $B$ that is finitely generated as an $A$-algebra is integral over $A$ if and only if it is finite as a module over $A$."
What do they mean here by "finite as a module over $A$" and how is that different from $B$ being finitely generated as an $A$-algebra?
 A: Suppose $A$ is a commutative ring, and $B$ is an $A$-algebra. We say $B$ is finitely generated as an $A$-algebra if $B$ admits a surjection $A[X_{1}, \ldots, X_{n}] \to B$ of $A$-algebras for some $n \in \mathbb{N}$. We say $B$ is finitely generated as an $A$-module if $B$ admits a surjection $A^{n} \to B$ of $A$-modules for some $n \in \mathbb{N}$.
The key difference in the above definitions is in what operations are "allowed". Less formally, if $B$ is finitely generated as an $A$-algebra, then that means that there are finitely many elements $b_{1}, \ldots, b_{n} \in B$ such that every element of $B$ can be expressed as a polynomial in $b_{1}, \ldots, b_{n}$ with coefficients in $A$. Likewise, $B$ is finitely generated as an $A$-module if there are $b_{1}, \ldots, b_{n} \in B$ such that every element of $B$ is an $A$-linear combination of $b_{1}, \ldots, b_{n}$. You can use the multiplication in $B$ in the first definition, but not the second.
Examples abound of finitely generated algebras which are not module finite. A nice example to illustrate the difference between the two: for any ring $A$, the polynomial ring $A[X]$ is finitely generated as an $A$-algebra, but not as an $A$-module. Indeed, $A[X]$ is a free $A$-module with infinite basis $\{1,X,X^{2}, \ldots\}$, and admits no $A$-basis with finite cardinality.
