Edit, after the parent was edited to include the data attribute example:
You should update your post to clarify that you're talking about data attributes. That's a significant detail and shouldn't have been left out.
Now that you've clarified, jQuery does behave as you've stated, but it's not a bug. I can see how it could be unexpected behavior to some, but it's explicitly stated in the .data() documentation:
Every attempt is made to convert the string to a
JavaScript value (this includes booleans, numbers,
objects, arrays, and null) otherwise it is left as a
string. To retrieve the value's attribute as a string
without any attempt to convert it, use the attr() method.
http://api.jquery.com/data/#data2