I've talked about changes in pronunciation concealing the original meaning of words before, and 마찬가지 is another example of this. Both 마찬가지 and 매한가지 similarly mean "same, alike" but have slightly different origins.
As one can see from examining the two words, they both end with the word 가지 which literally means "branch" but also commonly means "kind, sort" in a figurative sense. The "한" in 매한가지 is the shortened version of the Korean number one "하나," used when the number is combined with another word. What is interesting here is that 마찬가지 also has the number "한" in it, but the spelling has concealed it. 마찬가지 can be broken down as follows: "마치 + 한 + 가지" ("as if/ like + one + kind/ sort"). When combined with 한, the 치 of 마치 ends up merging with 한 to form 마찬 (마치 + 한 -> 마찬). If you repeat 마치 and 한 in succession quickly enough, you'll be able to intuitively feel why such a phonological and spelling change has occurred.
The 매 in 매한가지 simply means "having no distinction, like." So ultimately, when broken down and analyzed, both 매한가지 and 마찬가지 mean "like one kind/ sort."
*As a side note, the word "가지" in Korean has very similar cognates in both Tungusic ("gáčin") and Mongolian ("xačáin"), which is certainly not a coincidence given their shared history and linguistic similarity.
백문식. 우리말 어원 사전. 1st ed. 서울: 도서출판 박이정, 2014. Print.