That's one way to look at it. The other way is for the experience. So many children thing that eggs come from walmart these days. In addition if you google the way mass egg production facilities work you'll be pretty amazed. Most birds never see the light of day, many play tricks with the lights to produce an unnatural number of eggs per bird per year, and you never know what they are fed, most of which are fed medicated feed their entire lives. That medication ends up in your store bought egg.
You'll always know what your birds eat and you can even get a non-gmo option of feed.
The next way to look at it is you go to Tractor Supply or another farm store. You pick up four baby chicks. You wait 20 - 30 weeks before they start laying. You buy wire for a run $50, a coop for $400 - $800 and then realize that the coop is a cheap import from China that says "good for 4 birds" but you quickly realize it only fits about 2 but it's been more than 30 days so you can't return it. You setup a run, you buy food, you buy a feed dish, you buy a water dish. By the time the chicks are ready to hatch you discover half of them are roosters (since most stores only sell straight run unless you find a farmer direct with sex linked birds or buy from a source that knows how to sex baby chicks, even with a good person sexing chicks they are usually only good for 19 out of 20 birds). You know need to learn what things like pasty butt are, how to deal with lice, or even what extra snacks you can feed your chickens. Because you have no one to call, you have to research it yourself without any expert help.
So now you've spent $200 in feed waiting for the birds to lay eggs, $700 in coop supplies, your coops is not portable so you start to get a smell in your yard, and before the first egg lays you are exhausted and realize you don't want any chickens at all. The $900 you just spent has to be off loaded on craigslist for $200 (if you are lucky, because remember, your coop was too small to start with). Price per dozen? $700 for a dozen eggs if you actually made it that far.
Obviously, if you know what you are doing raising chickens really isn't that hard, but having that support system (phone, text, email, facebook group) and that ability to know that from day 1 you have two good egg laying hens eating good feed, you have the right size portable coop, and you can adopt everything at the end or 'chicken out' and return everything that $400 is cheap.
So yes, if you strictly want to count dollars and sense it is expensive per dozen eggs. But we count more than that, especially with all of the hormones and who knows what is pumped into so much food we buy at the store. Simply having one food source closer to home is a start of a lifestyle change!
Farm fresh eggs without the commitment.