If you're looking at costs, then the smaller battery almost always wins. The issue is range and performance.
My analysis shows that for most people, the big battery's limited shelf life is going to swamp cycle life in terms of overall battery life expectancy, thus increasing its cost/mile. Here's my reasoning:
First, assume that no matter what the pack size, the cycle life is the same. This may not be true, as the different packs use different density cells that may additionally support more cycles - but let's ignore that for now. Remember, a cycle is a full charge to full discharge and back to full charge. If you go from 100% SOC to 50% SOC and then back to 100% SOC, that's a half a cycle.
Second, let's look at Model S battery warranty: 8 years for both - 100K miles on the 40kWh.
Third, let's adjust the mileage per cycle from claimed to real since battery warranty mileage will be actual. I'll say 80%, so 160 miles is really 125 miles and 300 miles is really 240 miles.
100K miles divided by 125 miles/cycle is 800 cycles. Tesla is probably being conservative with the warranty, so let's say real life is 1000 cycles.
40 kWh goes 125 miles on a cycle, or 125,000 miles for the life of the battery. Cost is $20K. That's $0.016/mile.
85 kWh goes 240 miles on a cycle, or 240,000 miles for the life of the battery. Cost is $40K. That's $0.17/mile.
So, even though the bigger battery costs twice as much, it only costs about the same per mile. But, that assumes the shelf life of the batteries in infinite, which it isn't. If it were, then if you drive 10,000 miles a year, the 85kWh battery would last you 24 years. That ain't gonna happen.
Let's assume Tesla's 8yrs/100K miles warranty on the 40kWh properly expresses the relative effects of cycle and shelf life. That works out to 12,500 miles/year. Drive more and cycle life matters more - drive less and shelf life matters more.
But, on the big battery, to hit 1000 cycles in 8 years you need to drive 30,000 miles/year. That's one reason why Tesla offers an unlimited mileage warranty - most people won't drive that much. The other is the cycle life on that higher density chemistry is probably better, too, but that only helps if you're driving more than 30,000 miles a year, since otherwise the shelf life effects take over.
So, how can the big battery pay off? Let's try an extreme case: You do 30,000 miles/year but you drive the same distance every single day of every week or every month of every year. You do 84 miles a day every day, except Xmas, or 30,000/year. That also means you can get by with a 100 mile range per charge. Let's say after 8 years/1000 cycles a Model S battery is at 70% of its original capacity. That means the 85 kWh battery will take you 173 miles (instead of 240) after 8years/240K miles. So, you don't have to stop using it. Now, once batteries hit this amount of degradation, the rate of degradation increases, so it's not linear. So, instead of 4%/year, it's some higher number that gets higher each year. Let's say you get another 3 years before the range is too small. That means you've done about 330,000 miles on your $40K battery, or $0.12/mile. There, you've beaten the 40kWh battery. Of course, during those 13 years you would have replaced the 40kWh battery twice - and each time it would have been bigger and cheaper - meaning less money per kWh, so in the end you're probably still out more money with the big battery. And that's without considering the time value of the $20K you put into the big battery up front.
So, unless you want the increased acceleration, in terms of cost per mile you're better off with the smallest battery that has the range you need after 8 years/100Kish mile. And that's even if you do lots of miles per year, because that'll mean you'll be replacing that battery with an even cheaper per kWh battery sooner (you just gotta watch the range).