These houses are known as casas de malicia because they were designed to deceive.
The story behind this is that when it was decided in 1561 by Felipe II to move the royal court to Madrid, thereby making Madrid the official capital of Spain, there was insufficient space in Madrid (which at that time was just a small town) to house all of the people which made up his royal court. To solve this problem an edict was drawn up by Felipe II which stated that families who lived in houses with more than one floor had to give up one of the floors of their house to members of his royal court. This would ensure that all of his royal court had somewhere to live in Madrid. Naturally this edict was not received by the citizens of Madrid with great joy as they saw this edict merely as an abuse of power by Felipe II. So in order to avoid having to give up a floor of their house many families altered their houses by moving their rooms up to the higher floors of their dwelling, making false floors between the levels of the house, or moving the windows on the outside of the house around thus making it difficult to establish from street level how many floors the house actually had. Unfortunately a lot of the casas a la malicia in Madrid have disappeared but the best two examples still remain on calle del Toro and calle del Conde (both near the cathedral and the viaduct over calle de Segovia)
Google map: bit.ly/UCpxiU
Send your feedback or queries to firstname.lastname@example.org