I just tried with a thickness of 5, and the line is absolutely no thicker, but you are right that the rectangle appears as though it is a different size. However, this is actually expected behaviour, and lines up with the documentation…
Here I draw the same rectangles, once with a 5.0 thickness black outline, and then again with a 1.0 thickness pink outline.
g.setColour (Colours::black);
float thickness = 5.0f;
g.drawRect ( 10.0f, 100.0f, 50.0f, 20.0f, thickness );
g.drawRoundedRectangle( 10.5, 55.5, 50, 20, 4.0, thickness );
g.setColour(Colours::hotpink);
thickness = 1.0f;
g.drawRect ( 10.0f, 100.0f, 50.0f, 20.0f, 1.0f );
g.drawRoundedRectangle( 10.5, 55.5, 50, 20, 4.0, thickness );This results in the following output:

You can see that drawRect uses the rectangle as the outer bound, and the thickness extends inwards, as stated in the documentation - the line is used as a guide for the ‘outer edge’ of the brush. drawRoundedRectangle draws the line as a stroked path of the rectangle, where the line is used as a guide for the centre of the brush.
Really, these draw operations should take an alignment parameter (i.e. centre, inside, outside). Unfortunately, they don’t (right now, at least!).
You can of course draw a non-rounded rectangle using drawRoundedRectangle (and providing a corner size of zero). This way you at least get the same stroke behaviour regardless. However, If you want the rectangle to be entirely contained inside your ‘input’ rectangle (as with drawRect), you’ll need to shrink the rectangle you pass in by half the thickness.
For example…
[code]void drawRoundedRectangleInside (Graphics& g, const Rectangle& rect, float cornerSize, float thickness)
{
g.drawRoundedRectangle (rect.reduced(thickness/2, thickness/2), cornerSize, thickness);
}
void MyComponent::paint (Graphics& g)
{
g.setColour (Colours::black);
float thickness = 4.0f;
g.drawRect ( 10.0f, 10.0f, 50.0f, 20.0f, thickness );
drawRoundedRectangleInside (g, Rectangle(10.0f,40.0f,50.0f,20.0f), 0.0f, thickness);
drawRoundedRectangleInside (g, Rectangle(10.0f,70.0f,50.0f,20.0f), 4.0f, thickness);
thickness = 1.0f;
g.drawRect ( 70.0f, 10.0f, 50.0f, 20.0f, thickness );
drawRoundedRectangleInside (g, Rectangle(70.0f,40.0f,50.0f,20.0f), 0.0f, thickness);
drawRoundedRectangleInside (g, Rectangle(70.0f,70.0f,50.0f,20.0f), 4.0f, thickness);
}[/code]
… gives the following result…

You may also want to note that, in this approach, there is no need to manually add 0.5 to the coordinates, since that is automatically catered for by the adjustment for thickness.
Hope this helps!