I bet Sony's original budget counted on only 4GB being possible, and they are taking a hit for that 8G. But I wouldn't be surprised if this was in some of their calculation, and they were going to produce the most future proof solution regardless of initial cost.
The bigger risk was that when design work for PS4 was started, it was technologically impossible to have more than 2GB in the console, so there was a slight (OK, virtually non existent) risk, that they wouldn't have been able to have even 4 gigs.
Sony has been smart, but they have also been incredibly lucky.
I have a theory ("it must be bunnies") that Sony made the decision to go public with PS4 pretty much the minute when they realized that they could include 8 gigs of memory in the console. I mean, Kutaragi (or was it Yoshida who said so) must have really thought that they'd let Microsoft show their cards first. But maybe they thought that the memory amount would leak sooner or later, so they decided to control the publicity.