Ok I stepped through it and found the problem.
It turns out this will only happen if you have an already existing wp-config.php file in the directory just below the installation directory. This was happening to me because I had an installation of wordpress in the root folder, and it had its wp-config.php file there.
The problem is with a single line (ver 2.7):
In the file wp-blog-header.php, this line searches for two possible wp-config.php files:
if ( !file_exists( dirname(__FILE__) . '/wp-config.php') && !file_exists( dirname( dirname(__FILE__) ) . '/wp-config.php')) {
I guess this problem could be fixed by changing this line to:
if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
I haven't tried that myself. I simply moved my root wordpress installation somewhere else temporarily.