As dairy morphed into very large farms (500 - 5,000 cows) and the EPA regulated small farms to 50 cows or less before they had to register as CAFOs (confined animal feeding operations) regardless how large the farm actually is, the economics was less about the land cost than it was about the regulatory environment and feed costs. The bulk price of milk will not support high prices. 9 of 10 dairymen I knew didn't have a clue about the economics of their own operation. The wives handled that. The truth was these men were not making decent wages and didn't even realize it. They just went back to the lender year after year and borrowed a little more. And often it was the banker who told them they were losing money and typically, they sold the best cows, bought beef stock and used the worst of their dairy herd as beef cows and found a day job or part-time work.
My dad had a choice back 50 years ago. He either had to build a Grade A milk barn like his brothers or do something else. He said once, "If you can't beat 'em join 'em." He sold the dairy cows we were selling Commercial (Grade C) milk, which was used for canning evaporated milk, etc. and went to work for Pet Milk operating the steam boiler that they used to generate 440 v electricity.
I watched one of the biggest dairy operations go bankrupt and lose the whole farm about 15 years ago. These two brothers running it still live there on small acreages but going bankrupt in your 60s has to hurt. One of them went to work for John Deere dealer working in the shop and delivering tractors and equipment. Both had to work into their 70s just to exist modestly. And they still sell portable buildings and sheds at their places (which are side by side.) They were like a lot of farmers, just optimistic it would get better. Had they been able to hold out until Covid days, they could have cashed out when similar land tracts tripled in price. (Land went from $4,000-5000 an acre to $15,000/acre during Covid and developers and speculators simply swamped the county.)
I don't consider dairy to be more profitable than beef overall. And the cut off the last time I did that sort of an economic study was about $5,000 an acre. Beef is historically high now. The difference is that a dairy includes a barn, equipment, etc. you don't need on a beef op. Most beef farms are going to a simple hay barn or no barn, portable corrals and working pens. They have to option to sell the land high. Dairy, OTOH, is burdened by a dairy barn, maybe feed bins and a silo, and no one is willing to give a dime for these unless a dairy farmer too... and those are disappearing. I also see a beef operation or two that are mostly operating off rental land. These gives the operator a fixed cost basis to de their economics without the hassle of property ownership. Hay is cheap. Some farmers took some sage advice years ago - sell your tractor...hire it all done. In a beef operation, you can feed cattle with a flatbed pickup with a bale lift. You can hire bushhogging for less than $100/hour. And for $2,000 or less can brush hog a 40–80-acre parcel. That's less than payments on a tractor and doing it yourself. A good stock trailer and portable corrals - your costs are fixed and predictable. Poultry operations OTOH can probably over-pay for land up to 50% or so without hurting themselves too much. When borrowing $4 million or so to build a poultry complex, $200k more premium on land is not a biggie. For reference, I did a lot of chicken farms in the 90s under a CR license because the deminimus was $250k and most farms sold for less. I only had my mentor(s) sign off on the very few that were larger. Those farms were from 32,000 SF to 64,000 SF whereas the average farm today is a minimum of 144,000 SF with each barn being 36,000 SF.