If you ask for http://subdomain.example.com without anything, the url stays the same, but you see http://www.example.com
i might have misunderstood you here. does "the url stays the same" mean there is no 301 redirect and the address bar still shows this? http://subdomain.example.com and "you see http://www.example.com" means you see the content you expected to see for the www.example.com home page instead of the subdomain.example.com home page?
in this case perhaps there is an internal rewrite you aren't showing us.
another possibility is that http://subdomain.example.com is a non-canonical url and needs to be redirected to http://subdomain.example.com/subdomain/ or stated another way - should you ever serve content (200 OK) when the request is for the root directory of the subdomain?