Yes. Same way. The functionality of attribute dictionaries is defined in class Sketchup::Entity
so any of it’s subclasses can have them.
But in some older versions I think that attributes attached to materials did not save properly.
(Check API release notes.)
value = 50
model.materials["some_material"].set_attribute("MaterialDictionary", "Price", value)
Pls, use proper code quoting and parenthesis around argument lists.