I disagree the the sealing the envelope portion being better with cellulose.. The R value of cellulose (3.7) is close to the R value of open cell (3.2) and inferior to the R value of closed cell (6).
To me, there is simply no way that a blown in material that settles (gravity) and usually is not adhesive can match the ability to seal that expandable foam has. Shoot cellulose at a corner, shoot foam at a corner and compare, let alone a framed opening of "typical" quality where there are gaps.. Cellulose simply won't do the same job sealing those up.
I do totally agree that cellulose is certainly more cost effective per R value / inch. And there are places (like the deck of an attic) where it's use may be superior, especially when considering value per dollar.
If I had substantial depth in a wall or in a roof, I'd think that the best solution would be a combination of relatively thin sprayed on closed cell and then backing that insulation with a more cost effective option like cellulose... And I'd personally choose cellulose for a situation where I had an attic deck with no air handler in that space over the same amount of dollars spent on foam.