The correct option is C In spite of inheriting a lot of money, Mary is unhappy.
The words in the bracket are a group of prepositions; while combining a
sentence with a preposition, it is often followed by a noun or a gerund.
When the given sentences are combined, a gerund/noun follows the preposition.
In option C, the prepositions 'in spite of' combine the sentences together, and is followed by the gerund form 'inheriting' of the verb 'inherited', thereby retaining the meaning of the sentence. Hence it is the correct option.
Option A does not utilize the preposition correctly, it's only added to the sentence without changing its form. Hence A is incorrect.
Option B is grammatically incorrect, the preposition 'in spite of' is not followed by the gerund form of the verb 'inherited, and 'yet' is retained; even though 'in spite of' means the same as 'yet' (both cannot be in the sentence). Hence B is incorrect.
(While combining the sentences, the verb 'inherited' changes its form to a gerund/noun because prepositions are followed by nouns/gerunds.)
Option D has reversed the meaning of the original sentence. Hence D is incorrect.