"Road" vs "Mountain" Hubs
There is no interchangeability issue between "Road" vs "Mountain" cassettes and hubs as long as the number of sprockets matches.
Also, hubs marked "8-speed, 9-speed or 10-speed will work with any number of sprockets! (Add a 4.5 mm spacer before installing a 7-speed cassette on an 8-, 9-, or 10-speed hub.)
Any Shimano Hyperglide cassette will fit any Shimano Hyperglide hub with the following exceptions:
7-speed hubs only accept 7-speed cassettes.*
2004-2006 Dura-Ace 7800 10 speed hubs only accept Dura-Ace 10 speed cassettes.
Many older hubs have a problem with 11 tooth sprockets.
Capreo hubs and cassettes (special models with 9-tooth sprocket capability) are not interchangeable with anything else.
Although "Road" and "Mountain" hubs are no different as far as cassette fitting is concerned, they are different in terms of overall spacing. "Road" hubs generally use 130 mm spacing, while "mountain" hubs are 135 mm.
"Mountain" hubs will likely be slightly better sealed against dirt and mud than "road" hubs, but this is rarely an issue in practice. The wider 135 mm spacing will generally result in a slightly stronger wheel due to reduced dishing of the spokes.
"Sheldon Brown"