μάχομαι τῷ βασιλεῖ means -by any means- "I fight AGAINST the king". θνῄσκω τῷ λιμῷ means "I die BECAUSE of the famine".

Use of dative in the above examples is missinterpreted. In μάχομαι τῷ βασιλεῖ, the dative argument is a verbal complement (i.e the "object"); in Smyth's Greek Grammar it is classigied under the "comitative dative" (§ 1523 b.). In θνῄσκω τῷ λιμῷ, the dative argument denotes cause; cause as a thematic role can also be used in subject position: ὁ λιμός με (ἀπο)κτείνει "Famine kills me", manner by no means. So, a "dativus causae" perhaps should be added (see Smyth, § 1517).

The "dative of purpose" in Greek is very rare (if it exists at all).