Its actually rock... but in liquid form if that makes sense to you. The magma cools and then gets converted into rock. Much like water gets cold and turns to ice
Coal deposits that experienced melt due to contact with a magmatic intrusion would become part of the melt mix and would become a part of a body of solidified magma that is either intrusive or...