When a placeholder is replaced by a WordFragment, the tag container of the placeholder is replaced, including the inline styles of the tag. If the styles are applied to the parent element of the element (for example paragraph styles when doing an inline type replacement) then these styles of the parent remain. This doesn't happen when only the text is replaced as using replaceVariableByText (and other replace methods),
Using a Basic or an Advanced license you need to set the styles to be applied in the new content created with the WordFragment.
Premium licenses include the stylesReplacementType option in the replaceVariableByWordFragment method to apply the placeholder styles or mix the styles from the new content and the styles from the placeholder when doing the replacement.