Difference between random effect and fixed effect with regularization/prior

Let's say I have a random effect intercept. For example:

lme4::lmer(yield ~ 1 + (1|Batch))


How is that different than just ordinary regression using regularization or a prior?

 arm::bayesglm(yield ~ 1 + Batch,...)


They seem roughly equivalent to me.

However, I am not convinced that it is correct, otherwise what is the need for a package lme4, which is typically more computationally expensive to fit?
My intuition is that regularization is equivalent to a mixed model with a diagonal covariance matrix for the random effects. Whereas something like lme4 supports more general covariance structures.
• part of the difference is that mixed models are simultaneously estimating the appropriate degree of shrinkage (under the assumption that the random effects are Normally distributed). e.g. for bayesglm you have to specify the prior on the fixed effects. – Ben Bolker Aug 18 '18 at 21:17
• I think the answer there is correct, but of course it does not imply that the whole lme4 is just equivalent to ridge regression. lme4 can estimate very complicated covariance structures; but your example with one random intercept term is indeed very similar to having a L2 penalty (or prior), as explained in the linked answer. It's true what @BenBolker wrote though; it's more like empirical Bayes, where the prior is estimated from the data (or like ridge regression when the penalty is optimized over). – amoeba Aug 18 '18 at 21:58